/* ═══════════════════════════════════════════════════════════════
   LicenseHub Admin CSS — Custom Design (No Bootstrap)
   Color Palette:
     Orange accent : #f97316
     Dark cards    : #1a1a2e
     White content : #ffffff
     Page bg       : #f4f6f8
     Text dark     : #1e1e2d
     Text muted    : #6b7280
═══════════════════════════════════════════════════════════════ */

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

:root {
    --orange:      #f97316;
    --orange-dark: #ea6c0a;
    --orange-light:#fff4ed;
    --dark:        #1a1a2e;
    --dark2:       #2d2d3f;
    --white:       #ffffff;
    --bg:          #f4f6f8;
    --text:        #1e1e2d;
    --muted:       #6b7280;
    --border:      #e5e7eb;
    --sidebar-w:   260px;
    --radius:      12px;
    --shadow:      0 2px 12px rgba(0,0,0,0.07);
    --shadow-md:   0 4px 20px rgba(0,0,0,0.10);
}

html { font-size: 15px; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

/* ═══════════════════════════ SIDEBAR ════════════════════════════ */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border);
}

.logo-icon {
    width: 40px; height: 40px;
    background: var(--orange);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 20px;
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.3px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    padding: 8px 10px 6px;
    display: block;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.nav-item i { font-size: 1.1rem; flex-shrink: 0; }

.nav-item:hover {
    background: var(--orange-light);
    color: var(--orange);
}

.nav-item.active {
    background: var(--orange);
    color: #fff;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}

.help-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 10px;
}

.help-card i { color: var(--orange); font-size: 1.2rem; flex-shrink: 0; margin-top: 2px; }
.help-card p { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.help-card a { font-size: 0.78rem; color: var(--orange); text-decoration: none; }
.help-card a:hover { text-decoration: underline; }

.btn-upgrade {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: var(--orange);
    color: #fff;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
}
.btn-upgrade:hover { background: var(--orange-dark); }

/* ═══════════════════════════ MAIN WRAPPER ════════════════════════════ */
.main-wrapper {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ═══════════════════════════ TOPBAR ════════════════════════════ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    height: 64px;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 28px;
}

.breadcrumb {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.topbar-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border-radius: 8px;
    padding: 8px 14px;
    max-width: 400px;
}

.topbar-search i { color: var(--muted); font-size: 1rem; }

.topbar-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.88rem;
    color: var(--text);
    width: 100%;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    white-space: nowrap;
    font-size: 0.88rem;
    font-weight: 500;
}

.user-avatar {
    width: 34px; height: 34px;
    background: var(--orange-light);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--orange);
}

.logout-link {
    color: var(--muted);
    font-size: 1.1rem;
    text-decoration: none;
    transition: color .15s;
}
.logout-link:hover { color: var(--orange); }

/* ═══════════════════════════ PAGE CONTENT ════════════════════════════ */
.page-content {
    padding: 28px;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.page-header p {
    font-size: 0.88rem;
    color: var(--muted);
    margin-top: 2px;
}

/* ═══════════════════════════ FLASH MESSAGES ════════════════════════════ */
.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 28px 0;
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
}

.flash i { font-size: 1.1rem; }
.flash-close { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 1.2rem; opacity: .7; }
.flash-close:hover { opacity: 1; }

.flash-success { background: #ecfdf5; color: #065f46; }
.flash-error   { background: #fef2f2; color: #991b1b; }

/* ═══════════════════════════ STAT CARDS ════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    border-radius: var(--radius);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.stat-card.orange { background: var(--orange); color: #fff; }
.stat-card.dark   { background: var(--dark); color: #fff; }

.stat-card .card-icon {
    width: 44px; height: 44px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 16px;
}

.stat-card .card-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
}

.stat-card .card-label {
    font-size: 0.85rem;
    opacity: 0.85;
    font-weight: 500;
}

.stat-card .card-change {
    position: absolute;
    top: 16px; right: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255,255,255,0.2);
    padding: 3px 8px;
    border-radius: 20px;
}

/* ═══════════════════════════ CARDS / PANELS ════════════════════════════ */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 700;
}

.card-body { padding: 22px; }

/* ═══════════════════════════ TABLES ════════════════════════════ */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

thead th {
    background: var(--bg);
    padding: 11px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
    white-space: nowrap;
}

tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:hover { background: #fafafa; }
tbody tr:last-child td { border-bottom: none; }

.table-actions { display: flex; gap: 6px; align-items: center; }

/* ═══════════════════════════ BUTTONS ════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: background .15s, opacity .15s;
    white-space: nowrap;
}

.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); }

.btn-secondary { background: var(--bg); color: var(--text); }
.btn-secondary:hover { background: #e5e7eb; }

.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--orange);
    color: var(--orange);
}
.btn-outline:hover { background: var(--orange-light); }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }

.btn-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1.5px solid var(--border);
    background: var(--white);
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
}
.btn-icon:hover { border-color: var(--orange); color: var(--orange); }
.btn-icon.danger:hover { border-color: #dc2626; color: #dc2626; }

/* ═══════════════════════════ FORMS ════════════════════════════ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    outline: none;
    transition: border-color .15s;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,0.12);
}

textarea { resize: vertical; min-height: 90px; }

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ═══════════════════════════ SEARCH BAR ════════════════════════════ */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border-radius: 8px;
    padding: 8px 14px;
}

.search-bar i { color: var(--muted); }

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.88rem;
    color: var(--text);
    flex: 1;
}

/* ═══════════════════════════ BADGES ════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
}

.badge-active   { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #f3f4f6; color: #6b7280; }
.badge-expired  { background: #fee2e2; color: #dc2626; }

/* ═══════════════════════════ PAGINATION ════════════════════════════ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-top: 1px solid var(--border);
}

.pagination-info { font-size: 0.83rem; color: var(--muted); }

.pagination-links { display: flex; gap: 4px; }

.pagination-links a,
.pagination-links span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 6px;
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--text);
}

.pagination-links a:hover { background: var(--orange-light); color: var(--orange); }
.pagination-links .current { background: var(--orange); color: #fff; font-weight: 600; }
.pagination-links .disabled { opacity: .35; pointer-events: none; }

/* ═══════════════════════════ LOGIN PAGE ════════════════════════════ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.login-box {
    background: var(--white);
    border-radius: 18px;
    box-shadow: var(--shadow-md);
    padding: 44px 40px;
    width: 100%;
    max-width: 400px;
    margin: auto;
}

.login-box .brand {
    text-align: center;
    margin-bottom: 28px;
}

.login-box .brand .logo-icon {
    width: 52px; height: 52px;
    margin: 0 auto 12px;
    font-size: 24px;
}

.login-box .brand h1 {
    font-size: 1.5rem;
    font-weight: 800;
}

.login-box .brand p {
    color: var(--muted);
    font-size: 0.88rem;
    margin-top: 4px;
}

/* ═══════════════════════════ RECENT ACTIVATIONS ════════════════════════════ */
.activation-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.activation-row:last-child { border-bottom: none; }

.act-icon {
    width: 36px; height: 36px;
    background: var(--orange-light);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--orange);
    flex-shrink: 0;
}

.act-info { flex: 1; min-width: 0; }
.act-info p { font-size: 0.88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-info span { font-size: 0.78rem; color: var(--muted); }
.act-time { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }

/* ═══════════════════════════ EMPTY STATE ════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 52px 20px;
    color: var(--muted);
}

.empty-state i { font-size: 3rem; margin-bottom: 12px; display: block; opacity: .4; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 0.88rem; }

/* ═══════════════════════════ MISC ════════════════════════════ */
.key-mono {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--dark);
}

.text-muted { color: var(--muted); }
.text-sm { font-size: 0.82rem; }
.mt-4 { margin-top: 16px; }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 520px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--muted); }
.modal-body { padding: 22px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--border); }
