:root {
    --bg-dark: #0b0c10;
    --card-bg: rgba(22, 25, 35, 0.85);
    --card-border: rgba(255, 255, 255, 0.08);
    --primary: #e50914;
    --primary-hover: #f6121d;
    --accent: #3b82f6;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --danger: #ef4444;
    --success: #10b981;
    --radius: 12px;
}

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

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

/* Modal Overlay & Login Card */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    height: 56px;
    margin-bottom: 1rem;
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.input-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.input-group input[type="text"],
.input-group input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--accent);
}

.checkbox-group {
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group label {
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: pointer;
}

.btn-primary {
    width: 100%;
    padding: 0.85rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover {
    background: var(--primary-hover);

}

.btn-secondary {
    padding: 0.6rem 1.2rem;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-subtle {
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-subtle:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-danger-outline {
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger-outline:hover {
    background: var(--danger);
    color: #fff;
}

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
}

.link-back {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
}

.link-back:hover {
    color: #fff;
}

/* Dashboard Layout */
.dashboard-wrap {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-header {
    background: rgba(15, 17, 25, 0.95);
    border-bottom: 1px solid var(--card-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-logo {
    height: 40px;
}

.admin-title h1 {
    font-size: 1.25rem;
    font-weight: 800;
}

.badge-admin {
    background: rgba(229, 9, 20, 0.2);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.admin-user-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Tabs */
.admin-tabs {
    background: rgba(20, 23, 33, 0.6);
    border-bottom: 1px solid var(--card-border);
    padding: 0 2rem;
    display: flex;
    gap: 1rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #fff;
}

.tab-btn.active {
    color: #fff;
    border-bottom-color: var(--primary);
}

/* Main Content Area */
.admin-content {
    flex: 1;
    padding: 2rem;
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.content-header h2 {
    font-size: 1.5rem;
    font-weight: 800;

}

.content-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Grid Layouts */
.admin-grid-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .admin-grid-layout {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: #fff;
}

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

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th,
.admin-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.9rem;
}

.admin-table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.role-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

.role-badge.admin {
    background: rgba(229, 9, 20, 0.2);
    color: var(--primary);
}

.role-badge.user {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent);
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.btn-delete {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.btn-delete:hover {
    background: var(--danger);
    color: #fff;
}

/* Summary Grid */
.stats-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.card-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.card-summary-icon {
    font-size: 2.2rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.8rem;
    border-radius: 12px;
}

.card-summary-info h4 {
    font-size: 1.1rem;
    font-weight: 700;
}

.summary-time {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--accent);
    margin: 0.2rem 0;
}

.summary-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.style-top-gap {
    margin-top: 1.5rem;
}

.filter-controls {
    margin-bottom: 1rem;
}

.input-filter {
    width: 100%;
    max-width: 360px;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
}

.badge-type {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
}

.text-highlight {
    color: var(--accent);
}

.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* KPI Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
}

.kpi-icon {
    font-size: 2.2rem;
    width: 60px;
    height: 60px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
}

.icon-green { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.icon-blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.icon-red { background: rgba(229, 9, 20, 0.15); color: #f87171; }

.kpi-info {
    display: flex;
    flex-direction: column;
}

.kpi-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
    margin: 0.1rem 0;
}

.kpi-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Chart Container & Interactive Time Controls */
.chart-card {
    padding: 1.5rem;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.chart-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-icon {
    padding: 0.45rem 0.85rem;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-icon-subtle {
    padding: 0.45rem 0.85rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-icon-subtle:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.chart-scroll-box {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.chart-inner-wrap {
    min-width: 800px;
    height: 340px;
    position: relative;
}

/* User Table Editable Passwords & Detail Buttons */
.password-cell-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.input-pass-edit {
    width: 140px;
    padding: 0.4rem 0.6rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: #fff;
    font-size: 0.85rem;
    font-family: inherit;
}

.input-pass-edit:focus {
    border-color: var(--accent);
    outline: none;
}

.btn-save-pass {
    padding: 0.4rem 0.6rem;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-save-pass:hover {
    background: #3b82f6;
    color: #fff;
}

.btn-detail {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    margin-right: 6px;
}

.btn-detail:hover {
    background: var(--success);
    color: #fff;
}

/* User Inspector Detail Modal */
.detail-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
}

.modal-close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: #fff;
}

.detail-user-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--card-border);
}

.user-big-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e50914, #9b060e);
    color: #fff;
    font-size: 1.8rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.detail-user-info h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.3rem;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.detail-created, .detail-time-badge {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.detail-time-badge {
    color: var(--accent);
    font-weight: 700;
}

.detail-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}

.detail-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.detail-tab-btn.active {
    color: #fff;
    border-bottom-color: var(--primary);
}

.detail-section {
    display: none;
}

.detail-section.active {
    display: block;
}

.fav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.fav-card-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
