/* ================================================================
   License Manager — Admin Panel Styles
   Dark premium UI with sidebar navigation
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ----------------------------------------------------------------
   Reset & Base
   ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-base:       #0f1117;
    --bg-sidebar:    #13161f;
    --bg-card:       #1a1d2e;
    --bg-card-hover: #1f2340;
    --bg-input:      #12141f;
    --bg-table-alt:  #161929;

    --border:        #252840;
    --border-light:  #2d3158;

    --text-primary:  #e8eaf6;
    --text-secondary:#8f95c0;
    --text-muted:    #565b7a;

    --accent:        #6c63ff;
    --accent-glow:   rgba(108, 99, 255, 0.25);
    --accent-hover:  #7c74ff;

    --success:       #22c55e;
    --success-bg:    rgba(34, 197, 94, 0.12);
    --warning:       #f59e0b;
    --warning-bg:    rgba(245, 158, 11, 0.12);
    --danger:        #ef4444;
    --danger-bg:     rgba(239, 68, 68, 0.12);
    --info:          #38bdf8;
    --info-bg:       rgba(56, 189, 248, 0.12);
    --dark:          #374151;

    --sidebar-w:     240px;
    --header-h:      64px;
    --radius:        12px;
    --radius-sm:     8px;
    --shadow:        0 4px 24px rgba(0,0,0,0.4);
    --transition:    0.2s ease;
}

html, body {
    height: 100%;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* ----------------------------------------------------------------
   Layout
   ---------------------------------------------------------------- */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ----------------------------------------------------------------
   Sidebar
   ---------------------------------------------------------------- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-brand {
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand-icon {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-brand-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.sidebar-section {
    padding: 20px 12px 8px;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 8px;
    margin-bottom: 6px;
}

.sidebar-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition);
}

.sidebar-nav a:hover {
    background: rgba(108, 99, 255, 0.08);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: rgba(108, 99, 255, 0.15);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-nav .nav-icon {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    font-size: 15px;
    opacity: 0.8;
}

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

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.03);
}

.sidebar-user-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user a {
    color: var(--text-muted);
    font-size: 13px;
}
.sidebar-user a:hover { color: var(--danger); }

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

.topbar {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-base);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 13px;
}

.page-content {
    padding: 28px;
    flex: 1;
}

/* ----------------------------------------------------------------
   Cards
   ---------------------------------------------------------------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

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

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 20px; }

/* ----------------------------------------------------------------
   Stat Cards (Dashboard)
   ---------------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition), transform var(--transition);
}

.stat-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.stat-card.accent::before { background: linear-gradient(90deg, var(--accent), #a78bfa); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.info::before { background: var(--info); }

.stat-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.stat-icon {
    position: absolute;
    top: 18px; right: 18px;
    font-size: 28px;
    opacity: 0.08;
}

/* ----------------------------------------------------------------
   Tables
   ---------------------------------------------------------------- */
.table-wrapper {
    overflow-x: auto;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.data-table thead th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.data-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background var(--transition);
}

table.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

table.data-table tbody td {
    padding: 11px 14px;
    color: var(--text-secondary);
    vertical-align: middle;
}

table.data-table tbody td.primary {
    color: var(--text-primary);
    font-weight: 500;
}

table.data-table .mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
}

/* ----------------------------------------------------------------
   Badges
   ---------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.badge-success  { background: var(--success-bg);  color: var(--success); }
.badge-warning  { background: var(--warning-bg);  color: var(--warning); }
.badge-danger   { background: var(--danger-bg);   color: var(--danger); }
.badge-info     { background: var(--info-bg);     color: var(--info); }
.badge-secondary { background: rgba(255,255,255,0.07); color: var(--text-muted); }
.badge-dark     { background: rgba(55,65,81,0.5); color: #9ca3af; }
.badge-accent   { background: var(--accent-glow); color: var(--accent); }

/* ----------------------------------------------------------------
   Buttons
   ---------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 20px var(--accent-glow); }

.btn-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.btn-success:hover { background: rgba(34,197,94,0.2); }

.btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; }

/* ----------------------------------------------------------------
   Forms
   ---------------------------------------------------------------- */
.form-group { margin-bottom: 18px; }

label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.03em;
}

input[type="text"], input[type="password"], input[type="email"],
input[type="number"], select, textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    padding: 9px 12px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder { color: var(--text-muted); }

.input-group {
    display: flex;
    gap: 8px;
}
.input-group input { flex: 1; }

/* ----------------------------------------------------------------
   Search / Filter bar
   ---------------------------------------------------------------- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.01);
    flex-wrap: wrap;
}

.filter-bar input[type="text"],
.filter-bar select {
    width: auto;
    min-width: 180px;
    background: var(--bg-base);
}

/* ----------------------------------------------------------------
   Pagination
   ---------------------------------------------------------------- */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid transparent;
    transition: all var(--transition);
}

.pagination a:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    border-color: var(--border);
}

.pagination .active {
    background: var(--accent);
    color: #fff;
    font-weight: 700;
}

.pagination-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: auto;
}

/* ----------------------------------------------------------------
   Activity Feed
   ---------------------------------------------------------------- */
.activity-list {
    list-style: none;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

.activity-dot.ok { background: var(--success); box-shadow: 0 0 6px var(--success); }
.activity-dot.fail { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.activity-dot.warn { background: var(--warning); }
.activity-dot.muted { background: var(--text-muted); }

.activity-content { flex: 1; min-width: 0; }
.activity-key { font-size: 12px; font-family: monospace; color: var(--text-primary); font-weight: 600; }
.activity-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.activity-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ----------------------------------------------------------------
   Modal
   ---------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    padding: 28px;
    box-shadow: var(--shadow);
    transform: translateY(16px);
    transition: transform var(--transition);
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ----------------------------------------------------------------
   Alerts / Flash messages
   ---------------------------------------------------------------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.2); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border: 1px solid rgba(56,189,248,0.2); }

/* ----------------------------------------------------------------
   Login Page
   ---------------------------------------------------------------- */
.login-bg {
    min-height: 100vh;
    background: var(--bg-base);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(108,99,255,0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(167,139,250,0.06) 0%, transparent 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow), 0 0 80px rgba(108,99,255,0.06);
}

.login-logo {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    margin: 0 auto 20px;
    box-shadow: 0 8px 24px rgba(108,99,255,0.3);
}

.login-title {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-sub {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

/* ----------------------------------------------------------------
   Empty state
   ---------------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state-sub { font-size: 13px; }

/* ----------------------------------------------------------------
   Chart container
   ---------------------------------------------------------------- */
.chart-container {
    position: relative;
    height: 200px;
}

/* ----------------------------------------------------------------
   Utilities
   ---------------------------------------------------------------- */
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted   { color: var(--text-muted); }
.text-right   { text-align: right; }

.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

@media (max-width: 900px) {
    .grid-2 { grid-template-columns: 1fr; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
}

/* ----------------------------------------------------------------
   Scrollbar styling
   ---------------------------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }
