/* ========================================================
   MBASING - Aquatic/Swimming Theme with Glassmorphism
   ======================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@400;600;800&display=swap');

:root {
    /* Aquatic Color Palette */
    --primary: #0284c7;        /* Deep Cyan Blue */
    --primary-dark: #0369a1;
    --primary-light: #38bdf8;
    --accent: #06b6d4;         /* Cyan */
    --accent-light: #67e8f9;
    --success: #10b981;
    --danger: #f43f5e;
    --warning: #f59e0b;
    --dark: #0f172a;
    --text: #1e293b;
    --text-muted: #64748b;
    
    /* Backgrounds & Glassmorphism */
    --background: #f0f9ff;     /* Very Light Blue */
    --surface: rgba(255, 255, 255, 0.75);
    --surface-solid: #ffffff;
    --sidebar-bg: linear-gradient(180deg, #0c4a6e 0%, #082f49 100%);
    --border: rgba(14, 165, 233, 0.2);
    
    /* Variables */
    --radius: 16px;
    --shadow: 0 8px 32px rgba(2, 132, 199, 0.1);
    --shadow-hover: 0 12px 40px rgba(2, 132, 199, 0.2);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 260px;
}

[data-theme="dark"] {
    --primary: #38bdf8;
    --primary-dark: #0284c7;
    --primary-light: #7dd3fc;
    --accent: #22d3ee;
    --background: #020617;
    --surface: rgba(15, 23, 42, 0.75);
    --surface-solid: #0f172a;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(56, 189, 248, 0.2);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    background-image: radial-gradient(circle at 15% 50%, rgba(2, 132, 199, 0.05), transparent 25%),
                      radial-gradient(circle at 85% 30%, rgba(6, 182, 212, 0.05), transparent 25%);
    background-attachment: fixed;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    color: var(--primary-dark);
}
[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3 {
    color: var(--primary-light);
}

/* App Container & Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: white;
    position: fixed;
    height: 100vh;
    left: 0; top: 0;
    transition: var(--transition);
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    color: white;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.sidebar-header h2 i {
    color: var(--accent-light);
}

.nav-links {
    list-style: none;
    padding: 20px 0;
    overflow-y: auto;
    flex: 1;
}
.nav-links::-webkit-scrollbar { width: 4px; }
.nav-links::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.nav-links li {
    margin: 5px 15px;
}

.nav-links a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: 12px;
    transition: var(--transition);
    font-weight: 500;
    gap: 12px;
}

.nav-links a i {
    font-size: 1.4rem;
    transition: var(--transition);
}

.nav-links a:hover, .nav-links a.active {
    background: rgba(255,255,255,0.1);
    color: white;
}
.nav-links a.active {
    background: var(--primary);
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.4);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

/* Topbar */
.topbar {
    height: 70px;
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.menu-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text);
    cursor: pointer;
    display: none;
}

/* Content Area */
.content-area {
    padding: 30px;
    flex: 1;
}

.page { display: none; animation: fadeIn 0.4s ease-out; }
.page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Glassmorphism Cards */
.card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.card-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}
.form-group.full-width { grid-column: 1 / -1; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

input, select, textarea {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-solid);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: var(--transition);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    overflow-x: auto;
}
.tab-btn {
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
    white-space: nowrap;
}
.tab-btn:hover {
    background: rgba(2, 132, 199, 0.05);
    color: var(--primary);
}
.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}
.tab-pane { display: none; animation: fadeIn 0.3s ease; }
.tab-pane.active { display: block; }

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(2, 132, 199, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #34d399);
    color: white;
}
.btn-danger {
    background: linear-gradient(135deg, var(--danger), #fb7185);
    color: white;
}
.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(2, 132, 199, 0.05);
}

.btn-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    border: none;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.2rem;
}
.btn-icon.edit { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.btn-icon.edit:hover { background: var(--warning); color: white; }
.btn-icon.delete { background: rgba(244, 63, 94, 0.1); color: var(--danger); }
.btn-icon.delete:hover { background: var(--danger); color: white; }

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-solid);
}
table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}
th, td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
th {
    background: rgba(2, 132, 199, 0.05);
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
[data-theme="dark"] th { color: var(--primary-light); }
tbody tr { transition: var(--transition); }
tbody tr:hover { background: rgba(2, 132, 199, 0.02); }

.thumbnail {
    width: 48px; height: 48px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid var(--border);
}

/* Utilities */
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.mb-4 { margin-bottom: 25px; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-btn { display: block; }
    .sidebar-overlay {
        position: fixed; top:0; left:0; width:100%; height:100%;
        background: rgba(0,0,0,0.5); z-index: 99;
        display: none; opacity: 0; transition: var(--transition);
    }
    .sidebar-overlay.show { display: block; opacity: 1; }
    .card { padding: 15px; }
    .form-grid { grid-template-columns: 1fr; }
}

/* Stopwatches (legacy support for pages) */
.lanes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}
.lane-card {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}
.time-display {
    font-family: 'Outfit', monospace;
    font-size: 2.5rem;
    font-weight: 800;
    text-align: center;
    color: var(--primary-dark);
    letter-spacing: 2px;
}
[data-theme="dark"] .time-display { color: var(--primary-light); }

/* Floating Help */
.floating-help {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 9999;
}
.help-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}
.help-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    color: white;
}
.help-btn.wa { background: linear-gradient(135deg, #25D366, #128C7E); }
.help-btn.tg { background: linear-gradient(135deg, #0088cc, #005580); }
