/* Admin Dashboard Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100vh;
    height: 100dvh;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0f172a;
    color: #f8fafc;
    overflow-x: hidden;
    visibility: hidden;
}

body.loaded {
    visibility: visible;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: rgba(30, 41, 59, 0.8);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: #f8fafc;
}

.logo-badge {
    font-size: 11px;
    font-weight: 500;
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
}

.home-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(100, 116, 139, 0.2);
    border-radius: 8px;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s;
}

.home-btn:hover {
    background: rgba(100, 116, 139, 0.3);
    color: #f8fafc;
}

.home-btn svg {
    width: 18px;
    height: 18px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-name {
    font-size: 13px;
    color: #94a3b8;
}

.admin-role-badge {
    font-size: 11px;
    font-weight: 600;
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.15);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(167, 139, 250, 0.3);
}

.logout-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    padding: 0 24px;
    background: rgba(30, 41, 59, 0.5);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.tab {
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.tab:hover {
    color: #94a3b8;
}

.tab.active {
    color: #f8fafc;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Content */
.content {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Status Messages */
.status {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    display: none;
}

.status.show {
    display: block;
}

.status.info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.status.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.status.success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

/* Cards */
.card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: #f8fafc;
}

/* Summary Cards */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    padding: 20px;
}

.summary-label {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 8px;
}

.summary-value {
    font-size: 32px;
    font-weight: 700;
    color: #f8fafc;
}

.summary-value.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Period Selector */
.period-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.period-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.period-btn:hover {
    color: #94a3b8;
    border-color: rgba(148, 163, 184, 0.2);
}

.period-btn.active {
    color: #f8fafc;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-container {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    padding: 20px;
}

.chart-title {
    font-size: 14px;
    font-weight: 600;
    color: #f8fafc;
    margin-bottom: 16px;
}

.chart-wrapper {
    position: relative;
    height: 250px;
}

/* User Table */
.user-table {
    width: 100%;
    border-collapse: collapse;
}

.user-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.user-table td {
    padding: 16px;
    font-size: 14px;
    color: #e2e8f0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.05);
    vertical-align: middle;
}

.user-table tr:hover {
    background: rgba(148, 163, 184, 0.05);
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-weight: 500;
    color: #f8fafc;
}

.user-email {
    font-size: 13px;
    color: #64748b;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 4px;
    margin-bottom: 4px;
}

.badge.pending {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.badge.approved {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
}

.badge.admin {
    background: rgba(167, 139, 250, 0.1);
    color: #a78bfa;
}

.badge.beam {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
}

.badge.column {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
}

.badge.email-verified {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
}

.badge.email-unverified {
    background: rgba(251, 146, 60, 0.1);
    color: #fb923c;
}

/* User Sections (Pending/Active) */
.user-section {
    margin-bottom: 32px;
}

.user-section:last-child {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: #f8fafc;
    margin: 0;
}

.section-count {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    background: rgba(100, 116, 139, 0.2);
    padding: 4px 10px;
    border-radius: 999px;
}

.pending-section .section-title {
    color: #fb923c;
}

.pending-section .section-count {
    background: rgba(251, 146, 60, 0.1);
    color: #fb923c;
}

.active-section .section-title {
    color: #4ade80;
}

.active-section .section-count {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
}

.user-list-card {
    padding: 24px;
}

/* Toggle Switch */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle {
    position: relative;
    width: 40px;
    height: 22px;
    cursor: pointer;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(100, 116, 139, 0.3);
    border-radius: 22px;
    transition: all 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
    background: #f8fafc;
    border-radius: 50%;
    transition: all 0.2s;
}

.toggle input:checked + .toggle-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

.toggle-label {
    font-size: 12px;
    color: #94a3b8;
}

/* Action Buttons */
.action-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 6px;
    margin-bottom: 6px;
}

.action-btn.primary {
    background: rgba(102, 126, 234, 0.1);
    color: #818cf8;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.action-btn.primary:hover {
    background: rgba(102, 126, 234, 0.2);
}

.action-btn.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Create User Form */
.create-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.form-input {
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    color: #f8fafc;
    font-size: 14px;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
}

.form-input::placeholder {
    color: #64748b;
}

.create-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.create-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.create-btn:hover {
    opacity: 0.9;
}

.create-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Activity Table */
.activity-table {
    width: 100%;
    border-collapse: collapse;
}

.activity-table th,
.activity-table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
}

.activity-table th {
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.activity-table td {
    color: #e2e8f0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.05);
}

.activity-bar {
    height: 8px;
    background: rgba(100, 116, 139, 0.2);
    border-radius: 4px;
    overflow: hidden;
    min-width: 100px;
}

.activity-bar-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #64748b;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
    }

    .logo-badge {
        display: none;
    }

    .admin-name {
        display: none;
    }

    .tabs {
        padding: 0 16px;
        overflow-x: auto;
    }

    .tab {
        padding: 12px 16px;
        font-size: 13px;
        white-space: nowrap;
    }

    .content {
        padding: 16px;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .create-form {
        grid-template-columns: 1fr;
    }

    .user-table {
        display: block;
        overflow-x: auto;
    }

    .card {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .period-selector {
        flex-wrap: wrap;
    }

    .chart-wrapper {
        height: 200px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
}

::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.5);
}

/* Search */
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    max-width: 300px;
}

.search-box svg {
    width: 16px;
    height: 16px;
    color: #64748b;
}

.search-box input {
    flex: 1;
    background: none;
    border: none;
    color: #f8fafc;
    font-size: 14px;
    outline: none;
}

.search-box input::placeholder {
    color: #64748b;
}

/* Edit Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: #1e293b;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #f8fafc;
}

.modal-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #94a3b8;
}

.modal-body {
    padding: 20px;
}

.modal-field {
    margin-bottom: 16px;
}

.modal-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #94a3b8;
    margin-bottom: 6px;
}

.modal-field input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    color: #f8fafc;
    font-size: 14px;
}

.modal-field input:focus {
    outline: none;
    border-color: #667eea;
}

.modal-field input::placeholder {
    color: #64748b;
}

.modal-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.modal-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: #f8fafc;
    margin-bottom: 12px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.modal-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn.secondary {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
}

.modal-btn.secondary:hover {
    background: rgba(100, 116, 139, 0.3);
}

.modal-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-btn.primary:hover {
    opacity: 0.9;
}

.modal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.modal-error.show {
    display: block;
}
