/* Core Design System & CSS Variables for Hub */
:root {
    --bg-primary: #0a060a;
    --bg-secondary: #120912;
    --bg-tertiary: #190c19;
    --accent: #ffd700;
    --accent-glow: rgba(255, 215, 0, 0.3);
    --accent-hover: #ffea00;
    --text-primary: #f5f5f7;
    --text-secondary: #d4c2d4;
    --text-muted: #8e7a8e;
    --success: #00e676;
    --error: #ff1744;
    --glass-bg: rgba(255, 255, 255, 0.02);
    --glass-border: rgba(255, 255, 255, 0.07);
    --glass-shadow: rgba(0, 0, 0, 0.6);
    --font-sans: 'Inter', 'Noto Sans Thai', sans-serif;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

.bg-glow {
    position: fixed;
    width: 60vw;
    height: 60vw;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    opacity: 0.1;
    pointer-events: none;
}
.bg-glow-1 {
    top: -10%;
    left: -10%;
    background: radial-gradient(circle, #ffd700 0%, rgba(255, 215, 0, 0) 70%);
}
.bg-glow-2 {
    bottom: -10%;
    right: -10%;
    background: radial-gradient(circle, #9c27b0 0%, rgba(156, 39, 176, 0) 70%);
}
.bg-glow-3 {
    top: 30%;
    left: 45%;
    background: radial-gradient(circle, #00e676 0%, rgba(0, 230, 118, 0) 70%);
    width: 40vw;
    height: 40vw;
    opacity: 0.05;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 5%;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    background: rgba(18, 9, 18, 0.4);
}
.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.35rem;
    font-weight: 700;
}
.logo-icon {
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent-glow);
}
.admin-profile-tag {
    background: rgba(255, 215, 0, 0.1);
    color: var(--accent);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--accent);
}

/* Dashboard Workspace Layout */
.dashboard-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: calc(100vh - 73px);
}

/* Sidebar */
.sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px 16px;
}
.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}
.menu-item:hover, .menu-item.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}
.menu-item.active {
    border-left: 3px solid var(--accent);
    background: rgba(255, 215, 0, 0.05);
    color: var(--accent);
}

.sidebar-footer .user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--glass-border);
    padding-top: 20px;
}
.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    color: #000;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}
.user-info {
    display: flex;
    flex-direction: column;
}
.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}
.user-plan {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Area & Tab Pages */
.dashboard-main {
    padding: 40px;
    background: var(--bg-primary);
    overflow-y: auto;
    height: calc(100vh - 73px);
}
.dashboard-tab {
    display: none;
}
.dashboard-tab.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}
.tab-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.tab-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
}
.refresh-indicator {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}
.refresh-indicator:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
}
.stat-icon {
    font-size: 2rem;
}
.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin-top: 2px;
}

/* Glass card & Data Tables */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px 0 var(--glass-shadow);
    padding: 24px;
}
.mt-4 {
    margin-top: 30px;
}
h2 {
    font-size: 1.15rem;
    margin-bottom: 16px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}
.data-table th, .data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--glass-border);
}
.data-table th {
    font-weight: 600;
    color: var(--text-muted);
}
.data-table td {
    color: var(--text-secondary);
}

/* Badge States */
.status-pill {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-pill.online {
    background: rgba(0, 230, 118, 0.12);
    color: var(--success);
    border: 1px solid var(--success);
}
.status-pill.pending {
    background: rgba(255, 215, 0, 0.12);
    color: var(--accent);
    border: 1px solid var(--accent);
}
.status-pill.approved {
    background: rgba(0, 230, 118, 0.15);
    color: var(--success);
    border: 1px solid var(--success);
}
.status-pill.rejected {
    background: rgba(255, 23, 68, 0.15);
    color: var(--error);
    border: 1px solid var(--error);
}

.btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: var(--font-sans);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition);
}
.btn-primary {
    background: var(--success);
    color: #000;
}
.btn-primary:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}
.btn-danger {
    background: var(--error);
    color: #fff;
}
.btn-danger:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.table-header-toolbar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 20px;
}
.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}
.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.form-input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    outline: none;
    transition: var(--transition);
}
.form-input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.04);
}

.stats-visual-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 30px;
    margin-top: 30px;
}
.stat-summary-card {
    padding: 30px;
}
.chart-mockup {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}
.mock-chart-line-row {
    display: grid;
    grid-template-columns: 180px 1fr 50px;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
}
.bar-progress {
    height: 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    border-radius: 10px;
}

/* Toast Alerts */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(18, 9, 18, 0.95);
    border: 1px solid var(--glass-border);
    padding: 14px 22px;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    min-width: 300px;
    font-size: 0.9rem;
    animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.toast.success {
    border-left: 4px solid var(--success);
}
.toast.error {
    border-left: 4px solid var(--error);
}
.toast.info {
    border-left: 4px solid var(--accent);
}
@keyframes toastIn {
    from { transform: translateY(50px) scale(0.9); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

@media (max-width: 992px) {
    .dashboard-container {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none; /* simple hidden for mobile for now */
    }
}
