/* =====================================================
   SipLive SBC — Admin Panel
   ===================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --navy: #0b1220;
    --navy2: #0f172a;
    --navy3: #1e293b;
    --sky: #0ea5e9;
    --sky-dark: #0284c7;
    --white: #f8fafc;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: rgba(255,255,255,.08);
    --sidebar-w: 220px;
}

body.admin-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--navy);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    min-height: 100vh;
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.admin-sidebar {
    width: var(--sidebar-w);
    background: var(--navy2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 50;
}
.sidebar-logo {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .5rem;
}
.logo-text {
    font-size: 1rem;
    font-weight: 700;
    color: var(--white);
}
.logo-sbc {
    color: var(--sky);
}
.logo-badge {
    font-size: .65rem;
    font-weight: 700;
    background: rgba(14,165,233,.15);
    color: var(--sky);
    padding: .15rem .45rem;
    border-radius: 4px;
    margin-left: auto;
    letter-spacing: .05em;
}
.sidebar-nav {
    padding: .75rem .75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .75rem;
    border-radius: 6px;
    color: var(--muted);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    transition: background .15s, color .15s;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.06); color: var(--white); }
.nav-item.active { background: rgba(14,165,233,.15); color: var(--sky); }
.sidebar-footer {
    padding: .75rem;
    border-top: 1px solid var(--border);
}
.nav-logout { color: var(--muted); }

/* =====================================================
   MAIN CONTENT
   ===================================================== */
.admin-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.admin-topbar {
    background: var(--navy2);
    border-bottom: 1px solid var(--border);
    padding: .875rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
}
.page-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--white);
}
.topbar-user {
    font-size: .8rem;
    color: var(--muted);
}
.admin-content {
    padding: 1.5rem;
    flex: 1;
}

/* =====================================================
   FLASH MESSAGES
   ===================================================== */
.flash {
    padding: .75rem 1.25rem;
    border-radius: 6px;
    font-size: .875rem;
    margin: .75rem 1.5rem 0;
}
.flash-ok { background: rgba(22,163,74,.15); border: 1px solid rgba(22,163,74,.35); color: #86efac; }
.flash-err { background: rgba(220,38,38,.15); border: 1px solid rgba(220,38,38,.35); color: #fca5a5; }

/* =====================================================
   STAT GRID
   ===================================================== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}
.stat-card {
    background: var(--navy2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem 1rem;
    text-decoration: none;
    display: block;
}
.stat-label { font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--white); margin-top: .25rem; }
.stat-green .stat-value { color: #4ade80; }
.stat-amber .stat-value { color: #fbbf24; }
.stat-red   .stat-value { color: #f87171; }
.stat-blue  .stat-value { color: var(--sky); }
.stat-warn  .stat-value { color: #f87171; }
.stat-alert { border-color: rgba(239,68,68,.4); }

/* =====================================================
   ADMIN CARD
   ===================================================== */
.admin-card {
    background: var(--navy2);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    color: var(--white);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.card-header h2 { font-size: 1rem; font-weight: 700; color: var(--white); }
.btn-link { color: var(--sky); text-decoration: none; font-size: .85rem; }

/* =====================================================
   TABLE
   ===================================================== */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
}
.admin-table th {
    background: var(--navy3);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: .6rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.admin-table td {
    padding: .65rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.04);
    color: var(--text);
    vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(255,255,255,.02); }
.admin-table code {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: .78rem;
    color: var(--sky-light);
    background: rgba(14,165,233,.1);
    padding: .1rem .35rem;
    border-radius: 4px;
}
.empty-row { text-align: center; color: var(--muted); padding: 2rem; }
.text-muted { color: var(--muted); }

/* =====================================================
   STATUS BADGE
   ===================================================== */
.status-badge {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: .2rem .55rem;
    border-radius: 20px;
}
.status-active    { background: rgba(22,163,74,.2);   color: #4ade80; }
.status-suspended { background: rgba(202,138,4,.2);   color: #fbbf24; }
.status-revoked   { background: rgba(220,38,38,.2);   color: #f87171; }

/* =====================================================
   GUID
   ===================================================== */
.guid-short {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: .78rem;
    color: #94a3b8;
}
.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: .8rem;
    padding: 0 .2rem;
    transition: color .15s;
}
.copy-btn:hover { color: var(--sky); }

/* =====================================================
   FILTER BAR
   ===================================================== */
.filter-bar {
    display: flex;
    gap: .75rem;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.filter-input {
    flex: 1;
    min-width: 200px;
    padding: .45rem .75rem;
    background: var(--navy3);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px;
    color: var(--white);
    font-size: .875rem;
    font-family: inherit;
}
.filter-input:focus { outline: none; border-color: var(--sky); }
.filter-select {
    padding: .45rem .75rem;
    background: var(--navy3);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px;
    color: var(--white);
    font-size: .875rem;
    font-family: inherit;
}
.btn-primary {
    background: var(--sky);
    color: #fff;
    border: none;
    padding: .45rem 1rem;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    font-family: inherit;
}
.btn-primary:hover { background: var(--sky-dark); }
.btn-secondary {
    background: rgba(255,255,255,.08);
    color: var(--text);
    border: 1px solid var(--border);
    padding: .45rem 1rem;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
}
.btn-secondary:hover { background: rgba(255,255,255,.12); }
.btn-sm {
    background: rgba(14,165,233,.15);
    color: var(--sky);
    text-decoration: none;
    padding: .2rem .6rem;
    border-radius: 4px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}
.btn-sm:hover { background: rgba(14,165,233,.25); }

/* =====================================================
   PAGINATION
   ===================================================== */
.pagination-wrap {
    padding: .75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
}
.pagination-wrap nav { display: flex; gap: .35rem; }
.pagination-wrap span, .pagination-wrap a {
    padding: .3rem .65rem;
    border-radius: 4px;
    font-size: .8rem;
    color: var(--muted);
    text-decoration: none;
    border: 1px solid var(--border);
}
.pagination-wrap a:hover { background: rgba(255,255,255,.07); color: var(--white); }
.pagination-wrap [aria-current] { background: var(--sky); color: #fff; border-color: var(--sky); }

/* =====================================================
   DEVICE DETAIL
   ===================================================== */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.25rem;
    align-items: start;
}
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-field { padding: .75rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.05); }
.detail-field:last-child { border-bottom: none; }
.detail-label { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: .3rem; }
.detail-row { display: grid; grid-template-columns: 1fr 1fr; }
.guid-full-wrap { display: flex; align-items: center; gap: .75rem; }
.guid-full {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: .72rem;
    color: var(--sky-light);
    word-break: break-all;
}
.copy-btn-lg {
    background: rgba(14,165,233,.15);
    color: var(--sky);
    border: none;
    padding: .25rem .65rem;
    border-radius: 4px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.copy-btn-lg:hover { background: rgba(14,165,233,.3); }
.action-buttons { display: flex; flex-direction: column; gap: .5rem; padding: 1rem 1.25rem; }
.btn-action {
    padding: .55rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .15s;
    font-family: inherit;
}
.btn-action:hover { opacity: .85; }
.btn-green  { background: rgba(22,163,74,.25);  color: #4ade80; }
.btn-amber  { background: rgba(202,138,4,.25);  color: #fbbf24; }
.btn-red    { background: rgba(220,38,38,.25);  color: #f87171; }
.notes-textarea {
    width: 100%;
    padding: .6rem .85rem;
    background: var(--navy3);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 6px;
    color: var(--white);
    font-size: .875rem;
    font-family: inherit;
    resize: vertical;
    min-height: 90px;
}
.notes-textarea:focus { outline: none; border-color: var(--sky); }

/* =====================================================
   LOGIN PAGE (Breeze override)
   ===================================================== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy);
    padding: 2rem;
}
.login-card {
    background: var(--navy2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}
.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.login-logo .logo-siplive { font-size: 1.4rem; font-weight: 800; color: var(--white); }
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: .82rem; font-weight: 600; color: #cbd5e1; margin-bottom: .3rem; }
.form-input-admin {
    width: 100%;
    padding: .6rem .85rem;
    background: var(--navy3);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px;
    color: var(--white);
    font-size: .9rem;
    font-family: inherit;
    transition: border-color .15s;
}
.form-input-admin:focus { outline: none; border-color: var(--sky); }
.login-err { background: rgba(220,38,38,.15); border: 1px solid rgba(220,38,38,.35); color: #fca5a5; border-radius: 6px; padding: .6rem 1rem; font-size: .82rem; margin-bottom: 1rem; }
.login-submit {
    width: 100%;
    padding: .7rem;
    background: var(--sky);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: .5rem;
    font-family: inherit;
    transition: background .15s;
}
.login-submit:hover { background: var(--sky-dark); }
