:root {
    /* Color Palette */
    --bg-main: #0f111a;
    --bg-panel: rgba(25, 28, 41, 0.65);
    --bg-card: rgba(30, 34, 51, 0.8);
    
    --primary: #4ade80; /* Vibrant Green */
    --primary-hover: #22c55e;
    --secondary: #6366f1; /* Indigo */
    --secondary-hover: #4f46e5;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
    
    --radius-lg: 16px;
    --radius-md: 8px;
    --radius-sm: 4px;
    
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-blur: blur(12px);
    
    /* Typography */
    --font-main: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    background-image: radial-gradient(circle at 15% 50%, rgba(74, 222, 128, 0.05), transparent 25%),
                      radial-gradient(circle at 85% 30%, rgba(99, 102, 241, 0.05), transparent 25%);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* Base Elements */
h1, h2, h3, h4, h5 {
    font-weight: 600;
    color: var(--text-main);
}

a {
    text-decoration: none;
    color: inherit;
}

/* Glassmorphism Utilities */
.glass {
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

/* Views Management */
.view {
    display: none;
    height: 100vh;
    width: 100vw;
}

.view.active {
    display: flex;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Login Card */
#login-view {
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, rgba(30,34,51,1) 0%, var(--bg-main) 100%);
}

.login-card {
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    padding: 3rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-card .logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

.login-card h2 {
    margin-bottom: 0.5rem;
}

.login-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* Main Layout */
#main-layout {
    /* display is controlled by .view.active */
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    backdrop-filter: var(--glass-blur);
    z-index: 10;
}

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

.sidebar-header .logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--primary);
}

.role-badge {
    background: rgba(74, 222, 128, 0.1);
    color: var(--primary);
    border: 1px solid rgba(74, 222, 128, 0.2);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.user-info {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.user-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.user-id {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-links li {
    margin-bottom: 0.5rem;
}

.nav-item {
    display: block;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    transition: all 0.2s;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    background: var(--primary);
    color: #000;
}

/* Content Area */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.topbar {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 17, 26, 0.5);
    backdrop-filter: blur(5px);
}

.scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

/* Tabs Management */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease forwards;
}

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

.admin-only {
    display: none;
}

.show-admin.admin-only {
    display: flex;
}

.activity-edit-row input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.activity-edit-row input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Dashboard Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(74, 222, 128, 0.3);
}

.stat-card h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Tables */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(0, 0, 0, 0.2);
}

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

.data-table tr:last-child td {
    border-bottom: none;
}

.status-badge {
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-registered { background: rgba(99, 102, 241, 0.1); border: 1px solid var(--secondary); color: #818cf8; }
.status-arrived { background: rgba(234, 179, 8, 0.1); border: 1px solid #eab308; color: #fde047; }
.status-completed { background: rgba(74, 222, 128, 0.1); border: 1px solid var(--primary); color: var(--primary); }

/* Forms */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.form-card h2 {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.form-card h3 {
    margin: 2rem 0 1rem 0;
    color: var(--primary);
    font-size: 1.1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.2rem;
    text-align: left;
}

.input-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

input, select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    outline: none;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    border-color: var(--primary);
}

.activity-selections {
    margin-bottom: 1rem;
}

.activity-row {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: end;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--primary);
    color: #000;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-full {
    width: 100%;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

.mt-15 {
    margin-top: 1.5rem;
}

.error-msg {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    height: 20px;
}

/* Modals & Overlays */
.overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 90;
}

.modal.hidden, .overlay.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.modal-content h3 {
    margin-bottom: 0.5rem;
}

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2); 
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1); 
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2); 
}

/* Mobile Responsiveness */
.mobile-only {
    display: none !important;
}

@media (max-width: 768px) {
    .mobile-only {
        display: inline-flex !important;
    }
    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        bottom: 0;
        transition: left 0.3s ease;
        z-index: 1000;
        box-shadow: 5px 0 15px rgba(0,0,0,0.8);
        width: 280px;
    }
    .sidebar.open {
        left: 0;
    }
    .topbar {
        padding: 0 1rem;
    }
    .topbar h1 {
        font-size: 1.2rem;
    }
    .date-display {
        font-size: 0.8rem;
    }
    .scroll-area {
        padding: 1rem;
    }
    .form-card, .stat-card, .table-container {
        padding: 1rem;
        border-radius: var(--radius-md);
    }
    .data-table th, .data-table td {
        padding: 0.8rem 0.5rem;
        font-size: 0.85rem;
    }
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .section-header > div {
        flex-wrap: wrap;
    }
    .modal-content {
        padding: 1.5rem;
    }
}
