/* TriggerLwex Admin Panel - Ultra Minimal Dark Theme */

:root {
    --bg: #0a0a0b;
    --bg-elevated: #111113;
    --surface: #18181b;
    --surface-hover: #27272a;
    --accent: #8b5cf6;
    --accent-dim: rgba(139, 92, 246, 0.1);
    --accent-glow: rgba(139, 92, 246, 0.3);
    --green: #10b981;
    --green-dim: rgba(16, 185, 129, 0.1);
    --red: #ef4444;
    --red-dim: rgba(239, 68, 68, 0.1);
    --yellow: #f59e0b;
    --yellow-dim: rgba(245, 158, 11, 0.1);
    --text: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;
    --border: #27272a;
    --sidebar-w: 64px;
    --sidebar-expanded: 220px;
    --radius: 12px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

/* Sidebar - Compact by default */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width var(--transition);
    z-index: 100;
    overflow: hidden;
}

.sidebar:hover {
    width: var(--sidebar-expanded);
}

.logo {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.logo-img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
}

.logo span {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity var(--transition);
}

.sidebar:hover .logo span { opacity: 1; }

.nav-menu {
    list-style: none;
    padding: 12px 8px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-secondary);
    margin-bottom: 4px;
    white-space: nowrap;
}

.nav-item:hover {
    background: var(--surface);
    color: var(--text);
}

.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
}

.nav-item .icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.nav-item span:not(.icon) {
    opacity: 0;
    transition: opacity var(--transition);
}

.sidebar:hover .nav-item span:not(.icon) { opacity: 1; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--red);
    flex-shrink: 0;
}

.status-indicator.online {
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.sidebar-footer span {
    opacity: 0;
    transition: opacity var(--transition);
}

.sidebar:hover .sidebar-footer span { opacity: 1; }

/* Main Content */
.main-content {
    margin-left: var(--sidebar-w);
    padding: 24px 32px;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.header-title h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.header-title p {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

.admin-key-input {
    display: flex;
    gap: 8px;
}

.admin-key-input input {
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    width: 180px;
    transition: all var(--transition);
}

.admin-key-input input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Buttons */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--text-muted);
}

.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { filter: brightness(0.9); }

.btn-warning { background: var(--yellow); color: #000; }

.btn-success { background: var(--green); color: white; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }

/* Stats Grid - Compact */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    transition: all var(--transition);
    border: 1px solid transparent;
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
}

.stat-icon.blue { background: var(--accent-dim); }
.stat-icon.green { background: var(--green-dim); }
.stat-icon.red { background: var(--red-dim); }
.stat-icon.orange { background: var(--yellow-dim); }
.stat-icon.purple { background: var(--accent-dim); }
.stat-icon.cyan { background: rgba(6, 182, 212, 0.1); }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.025em;
    display: block;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.card-body { padding: 20px; }

.big-stat {
    font-size: 48px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.025em;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

/* Activity List */
.activity-list {
    list-style: none;
    max-height: 240px;
    overflow-y: auto;
}

.activity-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.activity-list li:last-child { border-bottom: none; }

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 12px 16px;
    text-align: left;
}

.table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 1px solid var(--border);
}

.table td {
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.table tbody tr {
    transition: background var(--transition);
}

.table tbody tr:hover {
    background: var(--surface-hover);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-active, .badge-success { background: var(--green-dim); color: var(--green); }
.badge-expired, .badge-failed, .badge-danger { background: var(--red-dim); color: var(--red); }
.badge-suspended { background: var(--yellow-dim); color: var(--yellow); }

/* Forms */
.form { max-width: 500px; }

.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    transition: all var(--transition);
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

/* Filter Group */
.filter-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-group input, .filter-group select {
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
}

.filter-group input { min-width: 200px; }

/* Generated Keys */
.generated-keys {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg);
    border-radius: var(--radius);
}

.generated-keys h4 { margin-bottom: 16px; font-size: 14px; }

.keys-list {
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 13px;
    max-height: 280px;
    overflow-y: auto;
}

.key-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--surface);
    border-radius: 8px;
    margin-bottom: 8px;
}

.key-item .key { color: var(--accent); font-weight: 500; }

.key-item .copy-btn {
    padding: 4px 10px;
    background: var(--surface-hover);
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    transition: all var(--transition);
}

.key-item .copy-btn:hover {
    background: var(--accent);
    color: white;
}

.keys-actions { display: flex; gap: 10px; margin-top: 16px; }

/* Sections */
.section { display: none; animation: fadeIn 0.3s ease; }
.section.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    width: 90%;
    max-width: 480px;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 16px; }

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all var(--transition);
}

.close-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.modal-body { padding: 20px; }

.modal-actions { display: flex; gap: 10px; margin: 16px 0; }

.extend-form {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.extend-form input {
    width: 80px;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
}

.extend-row { display: flex; align-items: center; gap: 8px; }
.extend-row span { color: var(--text-muted); font-size: 13px; }

/* License Details */
.license-details p {
    margin-bottom: 10px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
}

.license-details code {
    background: var(--bg);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
}

.toast {
    background: var(--surface);
    border-radius: 10px;
    padding: 14px 20px;
    margin-top: 10px;
    min-width: 240px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    border-left: 3px solid var(--accent);
}

.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.setting-item {
    padding: 20px;
    background: var(--bg);
    border-radius: var(--radius);
}

.setting-item h4 {
    font-size: 14px;
    margin-bottom: 8px;
}

.setting-item p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.setting-item code {
    display: block;
    padding: 10px 14px;
    background: var(--surface);
    border-radius: 6px;
    font-family: monospace;
    font-size: 12px;
    color: var(--accent);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* Activity Chart (New) */
.activity-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 60px;
    padding: 10px 0;
}

.chart-bar {
    flex: 1;
    background: var(--accent-dim);
    border-radius: 3px 3px 0 0;
    min-height: 4px;
    transition: all var(--transition);
}

.chart-bar:hover {
    background: var(--accent);
}

/* Revenue Card (New) */
.revenue-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--green);
}

.revenue-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--green);
    margin-top: 4px;
}

.revenue-trend.down { color: var(--red); }

/* Server Time (New) */
.server-time {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
}

#server-clock {
    font-family: monospace;
    color: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { width: var(--sidebar-w); }
    .sidebar:hover { width: var(--sidebar-w); }
    .main-content { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* Bulk Actions Bar */
.bulk-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--accent-dim);
    border-radius: var(--radius);
    margin-bottom: 20px;
    border: 1px solid var(--accent);
}

.bulk-actions-bar .bulk-buttons {
    display: flex;
    gap: 8px;
}

/* Checkbox styling */
.license-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Selected row */
.table tbody tr.selected {
    background: var(--accent-dim);
}

/* Nav badge for notifications */
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 9px;
    margin-left: auto;
}

.nav-badge.warning {
    background: var(--yellow);
    color: #000;
}

.nav-badge.danger {
    background: var(--red);
    color: white;
}

/* Toast warning variant */
.toast.warning {
    border-left-color: var(--yellow);
}

/* Light Theme */
body.light-theme {
    --bg: #f5f5f7;
    --bg-elevated: #ffffff;
    --surface: #ffffff;
    --surface-hover: #f0f0f2;
    --text: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-muted: #8e8e93;
    --border: #d2d2d7;
}

body.light-theme .sidebar {
    background: var(--bg-elevated);
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

body.light-theme .card {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

body.light-theme .stat-card {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

body.light-theme .badge-active,
body.light-theme .badge-success {
    background: rgba(16, 185, 129, 0.15);
}

body.light-theme .badge-expired,
body.light-theme .badge-failed,
body.light-theme .badge-danger {
    background: rgba(239, 68, 68, 0.15);
}

body.light-theme .badge-suspended {
    background: rgba(245, 158, 11, 0.15);
}

/* Header actions layout */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Improve form inputs for settings */
.setting-item input[type="file"] {
    padding: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    width: 100%;
}

/* Animation for status indicator */
.status-indicator {
    transition: all 0.3s ease;
}

/* Toast container improvements */
.toast-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Form row improvements */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

/* Better button disabled state */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* IP management specific styles */
#ipmanagement .form-row {
    align-items: flex-end;
}

#ipmanagement .form-row .btn {
    margin-bottom: 0;
}
