/* Admin Portal - Modern Sleep Study Aesthetic */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    /* Modern Dark Palette inspired by sleep study app */
    --primary-bg: #0a0e1a;
    --secondary-bg: #141824;
    --card-bg: #1a1f2e;
    --sidebar-bg: #0f1419;

    /* Accent Colors */
    --primary-accent: #5b5ff9;
    --primary-accent-hover: #4a4ee8;
    --secondary-accent: #7c3aed;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;

    /* Text Colors */
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    /* Borders & Dividers */
    --border-color: rgba(255, 255, 255, 0.1);
    --divider-color: rgba(255, 255, 255, 0.05);

    /* Dimensions */
    --sidebar-width: 280px;
    --border-radius: 12px;
    --border-radius-lg: 16px;

    /* Shadows & Effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --glow-purple: 0 0 20px rgba(91, 95, 249, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    background: var(--primary-bg);
    color: var(--text-primary);
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Animated Background */
.app-container::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 50%, rgba(91, 95, 249, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(124, 58, 237, 0.08) 0%, transparent 50%);
    animation: backgroundPulse 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes backgroundPulse {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(-5%, -5%) scale(1.05);
    }
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
    box-shadow: var(--shadow-md);
}

.logo-container {
    padding: 32px 24px;
    text-align: center;
    border-bottom: 1px solid var(--divider-color);
    margin-bottom: 24px;
}

.logo {
    font-size: 3rem;
    margin-bottom: 12px;
    filter: drop-shadow(0 0 10px rgba(91, 95, 249, 0.5));
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-8px);
    }
}

.app-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--primary-accent), var(--secondary-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.nav-list {
    list-style: none;
    padding: 0 16px;
    margin: 0;
    flex: 1;
}

.nav-item {
    padding: 14px 20px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 10px;
    font-weight: 500;
    font-size: 15px;
    color: var(--text-secondary);
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, var(--primary-accent), var(--secondary-accent));
    transition: height 0.3s ease;
    border-radius: 0 3px 3px 0;
}

.nav-item:hover {
    background: rgba(91, 95, 249, 0.1);
    color: var(--text-primary);
    transform: translateX(4px);
}

.nav-item:hover::before {
    height: 60%;
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(91, 95, 249, 0.15), rgba(124, 58, 237, 0.15));
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(91, 95, 249, 0.2);
}

.nav-item.active::before {
    height: 70%;
}

.nav-item a {
    color: inherit;
    text-decoration: none;
    display: block;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--divider-color);
}

.page-header h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.03em;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.logout-btn {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

/* Panels and Cards */
.panel {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    padding: 28px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.panel:hover {
    box-shadow: var(--shadow-lg);
    border-color: rgba(91, 95, 249, 0.3);
}

.panel-title {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    letter-spacing: -0.02em;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

@media (max-width: 1400px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (max-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 640px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background: linear-gradient(135deg, var(--card-bg), rgba(91, 95, 249, 0.05));
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 28px 24px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-accent), var(--secondary-accent));
    transform: scaleX(0);
    transition: transform 0.4s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md), var(--glow-purple);
    border-color: rgba(91, 95, 249, 0.4);
}

.card:hover::before {
    transform: scaleX(1);
}

.card-value {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    background: linear-gradient(135deg, var(--primary-accent), var(--secondary-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 12px 0;
    letter-spacing: -0.02em;
}

.card-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

/* Tabs */
.tab-container {
    margin-top: 20px;
}

/* Tabs */
.tab-container {
    margin-top: 32px;
}

.tab-header {
    display: flex;
    border-bottom: 2px solid var(--divider-color);
    margin-bottom: 28px;
    gap: 8px;
}

.tab {
    padding: 12px 24px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 15px;
    position: relative;
}

.tab::after {
    content: '';
    /* position: absolute; */
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 80%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-accent), var(--secondary-accent));
    transition: transform 0.3s ease;
    border-radius: 2px 2px 0 0;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary-accent);
    font-weight: 600;
}

.tab.active::after {
    transform: translateX(-50%) scaleX(1);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border-radius: var(--border-radius);
}

th,
td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--divider-color);
}

th {
    background: rgba(91, 95, 249, 0.1);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

tr {
    transition: background 0.2s ease;
}

tr:hover {
    background: rgba(91, 95, 249, 0.05);
}

td {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, var(--primary-accent), var(--secondary-accent));
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(91, 95, 249, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(91, 95, 249, 0.5);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 2px 8px rgba(91, 95, 249, 0.2) !important;
}

.btn:disabled:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(91, 95, 249, 0.2);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--text-secondary), var(--text-muted));
    box-shadow: 0 2px 8px rgba(156, 163, 175, 0.3);
}

.btn-secondary:hover {
    box-shadow: 0 4px 16px rgba(156, 163, 175, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #059669);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.5);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #f59e0b);
    color: #1a1f2e;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.5);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.filter-btn {
    background: linear-gradient(135deg, var(--info-color), #0891b2);
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.filter-btn:hover {
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.5);
}

.reset-btn {
    background: linear-gradient(135deg, #374151, #1f2937);
    box-shadow: 0 2px 8px rgba(55, 65, 81, 0.3);
}

.reset-btn:hover {
    box-shadow: 0 4px 16px rgba(55, 65, 81, 0.5);
}

.create-btn {
    background: linear-gradient(135deg, var(--success-color), #059669);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.create-btn:hover {
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.5);
}

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

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    background: var(--secondary-bg);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(91, 95, 249, 0.1);
}

.form-actions {
    margin-top: 24px;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Filters */
.filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    align-items: flex-end;
}

.filter-group,
.sort-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
    flex: 1;
}

.filter-group label,
.sort-group label {
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 14, 26, 0.8);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card-bg);
    margin: 5% auto;
    padding: 0;
    width: 600px;
    max-width: 90%;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--divider-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
}

.close-modal {
    color: var(--text-secondary);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--divider-color);
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Utilities */
.hidden {
    display: none !important;
}

.error-message {
    color: var(--danger-color);
    padding: 14px 16px;
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--danger-color);
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
}

.success-message {
    color: var(--success-color);
    padding: 14px 16px;
    background: rgba(16, 185, 129, 0.1);
    border-left: 3px solid var(--success-color);
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
}

.loading {
    text-align: center;
    padding: 48px;
    color: var(--text-secondary);
}

.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.3px;
    border: 1px solid;
}

.status-acquiring,
.status-pending {
    background: rgba(6, 182, 212, 0.15);
    color: var(--info-color);
    border-color: rgba(6, 182, 212, 0.3);
}

.status-processing {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
    border-color: rgba(245, 158, 11, 0.3);
}

.status-completed {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
    border-color: rgba(16, 185, 129, 0.3);
}

.status-failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--primary-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Detail Views */
.detail-row {
    display: flex;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.detail-label {
    width: 180px;
    font-weight: 600;
    color: #555;
}

.detail-value {
    flex: 1;
    word-break: break-word;
}

/* Login Specific */
.login-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 400px;
    max-width: 90%;
    margin: 100px auto;
}