/* Fonts & Base Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

/* Theme Variables */
:root {
    /* Light Mode (default) */
    --color-bg-body: #e9eff5;
    --color-surface: rgba(255, 255, 255, 0.95);
    --color-surface-2: rgba(255, 255, 255, 0.92);
    --color-navbar: rgba(255, 255, 255, 0.98);
    --color-card: #ffffff;
    --color-card-alt: rgba(250, 252, 255, 0.9);
    --color-text-primary: #1f2d3d;
    --color-text: #1f2d3d;
    --color-text-secondary: #34495e;
    --color-text-tertiary: #2c3e50;
    --color-text-muted: #606f7b;
    --color-text-label: #4a5a6a;
    --color-text-scale: #6c7a8a;
    --color-border: #eaeaea;
    --color-border-light: #dce4ec;
    --color-hover: #fafafa;
    --color-hover-alt: #f2f4f7;
    --color-table-head: #f5f7fa;
    --color-button-bg: #dce4ec;
    --color-button-hover: #c7d3df;
    --color-track: #dce4ec;
    --color-block: #d3d3d3;
    --color-block-alt: #e0e0e0;
    --color-archived: #f0f0f0;
    --color-archived-text: #7a7a7a;
    --color-archived-hover: #e0e0e0;
    --color-input-border: #dce4ec;
    --color-edit-border: #ccc;
    --shadow-navbar: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-container: 0 8px 30px rgba(0, 0, 0, 0.15);
    --shadow-wrapper: 0 10px 30px rgba(0, 0, 0, 0.08);
    --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-card-hover: 0 4px 16px rgba(0, 0, 0, 0.05);
    /* Sleep row hover + tooltip defaults (light mode) */
    --sleep-hover-bg: rgba(0, 0, 0, 0.05);
    --sleep-tooltip-bg: #ffffff;
    --sleep-tooltip-color: var(--color-text-primary);
    /* Button text colors (light mode default: light text) */
    --btn-text-default: #ffffff;
    --btn-text-active: #1a2332;
}

body.dark-theme {
    /* Dark Mode */
    --color-bg-body: #1a1f2e;
    --color-surface: rgba(30, 35, 50, 0.95);
    --color-surface-2: rgba(30, 35, 50, 0.92);
    --color-navbar: rgba(25, 30, 45, 0.98);
    --color-card: #242938;
    --color-card-alt: rgba(28, 33, 48, 0.9);
    --color-text-primary: #e4e7eb;
    --color-text: #e4e7eb;
    --color-text-secondary: #b8bcc4;
    --color-text-tertiary: #c8cdd6;
    --color-text-muted: #9ca3af;
    --color-text-label: #c1c7d0;
    --color-text-scale: #8a92a3;
    --color-border: #3a4051;
    --color-border-light: #4a5568;
    --color-hover: #2d3342;
    --color-hover-alt: #333847;
    --color-table-head: #2a2f3e;
    --color-button-bg: #3a4051;
    --color-button-hover: #4a5568;
    --color-track: #3a4051;
    --color-block: #4a5568;
    --color-block-alt: #565d70;
    --color-archived: #2a2f3e;
    --color-archived-text: #9ca3af;
    --color-archived-hover: #333847;
    --color-input-border: #4a5568;
    --color-edit-border: #565d70;
    --shadow-navbar: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow-container: 0 8px 30px rgba(0, 0, 0, 0.4);
    --shadow-wrapper: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-card-hover: 0 4px 16px rgba(0, 0, 0, 0.25);
    /* Dark mode overrides for sleep hover + tooltip */
    --sleep-hover-bg: rgba(0, 0, 0, 0.18);
    --sleep-tooltip-bg: #242938;
    --sleep-tooltip-color: var(--color-text-primary);
    /* Dark mode button text: dark default, light on active */
    --btn-text-default: #1a2332;
    --btn-text-active: #f0f0f0;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 70px;
    background-color: var(--color-bg-body);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    background-attachment: fixed;
    backdrop-filter: blur(4px);
    transition: background-color 0.3s ease;
}

/* Navbar Styles */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--color-navbar);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-navbar);
    z-index: 1000;
    height: 60px;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--color-text-primary);
    transition: color 0.3s ease;
}

.navbar-logo {
    width: 35px;
    height: 35px;
    border-radius: 8px;
}

.navbar-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-text-primary);
    transition: color 0.3s ease;
}

.navbar-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Navbar Links - button base with gradient backgrounds */
.navbar-link {
    padding: 8px 18px;
    text-decoration: none;
    color: var(--btn-text-default) !important;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease, color 0.3s ease;
    /* Background set by navbar.js from data-gradient attribute */
}

.navbar-link:hover {
    transform: translateY(-2px);
    opacity: 0.95;
}

.navbar-link:focus-visible {
    outline: 2px solid var(--color-text-primary);
    outline-offset: 2px;
}

/* Active state - inverse color */
.navbar-link.active,
.navbar-link.is-active {
    color: var(--btn-text-active) !important;
    font-weight: 700;
}

.navbar-icon-link {
    background: transparent !important;
    color: var(--color-text-primary) !important;
    padding: 6px 10px;
    font-size: 1.1rem;
    box-shadow: none !important;
}

.navbar-icon-link:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    cursor: pointer;
    border: none;
    background: transparent !important;
    font-size: 1.3rem;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, opacity 0.3s ease;
    box-shadow: none !important;
    color: var(--color-text-primary) !important;
}

.theme-toggle-btn:hover {
    transform: translateY(-2px) scale(1.1);
    opacity: 0.8;
}

.theme-toggle-btn .theme-icon {
    display: block;
    line-height: 1;
    color: inherit;
}

/* Page Content Wrapper */
.page-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    width: 100%;
}

.page-content .wrapper {
    margin: 0 auto;
}

/* Container & Wrapper */
.container {
    background: var(--color-surface-2);
    padding: 70px 50px;
    border-radius: 24px;
    text-align: center;
    box-shadow: var(--shadow-container);
    max-width: 550px;
    width: 90%;
    animation: fadeIn 0.6s ease-in-out;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.wrapper {
    max-width: 900px;
    width: 100%;
    background: var(--color-surface);
    border-radius: 24px;
    box-shadow: var(--shadow-wrapper);
    padding: 40px;
    animation: fadeIn 0.5s ease-in-out;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* Typography */
h1 {
    text-align: center;
    font-size: 2.6rem;
    color: var(--color-text-primary);
    margin-bottom: 30px;
    transition: color 0.3s ease;
}

h2 {
    font-size: 2rem;
    color: var(--color-text-primary);
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

p {
    font-size: 1.2rem;
    color: var(--color-text-muted);
    margin-bottom: 40px;
    transition: color 0.3s ease;
}

/* ===========================
   UNIFIED BUTTON SYSTEM
   ========================= */

/* Base Button - for all buttons */
.btn {
    display: inline-block;
    text-decoration: none;
    color: var(--btn-text-default) !important;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: transform 0.3s ease, opacity 0.3s ease, color 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    opacity: 0.95;
}

.btn:active {
    transform: translateY(0);
}

.btn:focus-visible {
    outline: 2px solid var(--color-text-primary);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Active state for buttons - inverse color */
.btn.is-active {
    color: var(--btn-text-active) !important;
    font-weight: 700;
}

/* Modyfikatory */
.btn--large {
    padding: 14px 32px;
    font-size: 1.05rem;
}

.btn--small {
    padding: 6px 12px;
    font-size: 0.9rem;
}

.btn--danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.btn--secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
}

/* Legacy .button class - used in index.html and auth forms */
.button, a.button, button.button {
    display: inline-block;
    text-decoration: none;
    color: var(--btn-text-default) !important;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: transform 0.3s ease, opacity 0.3s ease, color 0.3s ease;
}

.button:hover, a.button:hover, button.button:hover {
    transform: translateY(-2px);
    opacity: 0.95;
}

.button-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
}

/* View Selector (Day/Week/Month Menu) */
.view-selector {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    gap: 20px;
}

.view-button {
    padding: 10px 20px;
    font-weight: 600;
    border-radius: 10px;
    text-decoration: none;
    color: var(--btn-text-default) !important;
    border: none;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease, color 0.3s ease;
    /* Background set by inline style from template */
}

.view-button:hover {
    transform: translateY(-2px);
    opacity: 0.95;
}

.view-button:focus-visible {
    outline: 2px solid var(--color-text-primary);
    outline-offset: 2px;
}

/* Active state - inverse color */
.view-button.active,
.view-button.is-active {
    color: var(--btn-text-active) !important;
    font-weight: 700;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 50px;
}

.left-buttons,
.right-buttons {
    display: flex;
    gap: 12px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}

thead {
    background-color: var(--color-table-head);
    transition: background-color 0.3s ease;
}

th, td {
    padding: 14px 10px;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
    transition: border-color 0.3s ease, color 0.3s ease;
}

th {
    font-weight: 600;
    color: var(--color-text-secondary);
}

td:first-child {
    text-align: left;
    font-weight: 500;
    color: var(--color-text-tertiary);
}

tr:hover {
    background-color: var(--color-hover);
    transition: background-color 0.2s ease-in-out;
}

/* Form Elements */
input[type="checkbox"] {
    transform: scale(1.2);
    cursor: pointer;
    accent-color: #007bff;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Accessibility: Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .btn:hover,
    .navbar-link:hover,
    .view-button:hover,
    .form-button:hover,
    .habit-button:hover,
    .theme-toggle-btn:hover {
        transform: none;
    }
}

/* Sleep Day Timeline */
.sleep-timeline-container {
    padding: 0 30px 30px 30px;
    overflow-x: auto;
}

.hour-line {
    display: flex;
    gap: 22px;
    margin-bottom: 8px;
    margin-left: -15px;
}

.hour {
    text-align: center;
    font-size: 0.7rem;
    color: var(--color-text-tertiary);
    transition: color 0.3s ease;
}

.timeline {
    display: flex;
    gap: 4px;
    overflow-x: auto;
}

.block {
    width: 48px;
    height: 60px;
    background-color: var(--color-block);
    border-radius: 8px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 5px;
    user-select: none;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Mood Month View Styles */
.mood-month-container {
    max-width: 480px;
    margin: 0 auto;
}

.mood-weekdays-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 6px;
}

.mood-weekday-label {
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-text-label);
    font-weight: 600;
}

.mood-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    row-gap: 6px;
}

.mood-block {
    width: 48px;
    height: 48px;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.mood-empty {
    color: var(--color-text-muted);
    background: var(--color-block-alt);
}

.form-submit {
    margin-top: 20px;
    text-align: center;
}

#selection_status {
    margin-top: 15px;
    font-weight: 600;
    text-align: center;
    color: var(--color-text-primary);
    transition: color 0.3s ease;
}

#sleep_summary {
    text-align: center;
    margin-top: 10px;
    font-size: 1rem;
    font-weight: 600;
}

/* Form Buttons (Save/Delete w sleep_day.html i innych formach) */
.form-button {
    color: var(--btn-text-default);
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: transform 0.3s ease, opacity 0.3s ease, color 0.3s ease;
    /* Background ustawiany przez inline style="background: {{ button_gradient }}" */
}

.form-button:hover {
    transform: translateY(-2px);
    opacity: 0.95;
}

.form-button:active {
    transform: translateY(0);
}

.form-button:focus-visible {
    outline: 2px solid var(--color-text-primary);
    outline-offset: 2px;
}

.form-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Delete variant - można usunąć jeśli używa button_gradient */
.form-button.delete {
    /* Background już ustawiony przez inline style w template */
}

/* Headings & Navigation */
.centered-heading {
    text-align: center;
    margin-bottom: 20px;
    color: var(--color-text-primary);
    transition: color 0.3s ease;
}

.date-nav {
    text-align: center;
    margin-bottom: 20px;
}

.date-nav a {
    font-size: 1.2rem;
    margin: 0 20px;
}

.week-display, .date-display, .month-display {
    font-weight: 600;
    color: var(--color-text-label);
    min-width: 220px;
    text-align: center;
    font-size: 1.1rem;
    font-family: 'Inter', sans-serif;
    margin: 0;
    transition: color 0.3s ease;
}

/* Delete/Edit/Archive Buttons */
.delete-button {
    margin-left: 10px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

/* Sleep Month Table */
.week-table {
    border-collapse: collapse;
    width: 100%;
}

.week-table th, .week-table td {
    width: 18px;
    min-width: 0;
    max-width: 18px;
    padding: 1px !important;
    overflow: visible;
}
.week-table td:last-child {
    width: 40px;
    min-width: 0;
    font-size: 0.8rem;
    padding: 0;
    text-align: center;
}

.week-table th:first-child, .week-table td:first-child {
    min-width: 35px;
    padding-left: 20px;
    padding-right: 10px;
}

.hour-label {
    font-weight: bold;
    font-size: 0.8rem;
    color: var(--color-text-tertiary);
    padding-top: 8px;
    padding-bottom: 8px;
    transition: color 0.3s ease;
}

.day-label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-right: px;
    text-align: left;
    white-space: nowrap;
}

.block-month {
    width: 40px;
    height: 30px;
    background-color: var(--color-block);
    border-radius: 6px;
    margin: 0 auto;
    transition: background-color 0.3s ease;
}

/* Rivio Day */
.habits-list {
    display: flex;
    flex-direction: column;
    margin-top: 30px;
    gap: 4px;
}

.habit-item {
    padding: 16px 24px;
    background: var(--color-card);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.habit-item:hover {
    background: var(--color-hover-alt);
}

.habit-item.done {
    text-decoration: line-through;
    background: var(--color-archived);
    color: var(--color-archived-text);
}

.navigation,
.navigation-month {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-size: 1.2rem;
    user-select: none;
    margin-bottom: 20px;
}

.navigation-month {
    font-size: inherit;
}

.nav-arrow,
.nav-arrow-month {
    width: 28px;
    height: 28px;
    cursor: pointer;
    user-select: none;
}

.date-display,
.month-display {
    color: var(--color-text-label);
    font-weight: 600;
    min-width: 220px;
    text-align: center;
    transition: color 0.3s ease;
}

.cell {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background-color: var(--color-block-alt);
    margin: 0 auto;
    cursor: pointer;
    transition: background 0.2s ease;
    display: block;
}

/* Rivio Month Table */
.table-container-month {
    overflow-x: auto;
    margin-top: 20px;
}

.table-month {
    min-width: 1000px;
    border-collapse: collapse;
}

.th-month div {
    white-space: nowrap;
}

.td-month, .th-month {
    min-width: 60px;
    text-align: center;
    padding: 8px;
}

.cell-month {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background-color: var(--color-block-alt);
    margin: 0 auto;
    cursor: pointer;
    transition: background 0.2s ease;
    display: block;
}

.cell-month.active {
    background: #abcdef;
}

/* Responsive Month View */
@media (max-width: 768px) {
    .table-month {
        font-size: 0.85rem;
    }
    .td-month, .th-month {
        min-width: 50px;
        padding: 6px 4px;
    }
    .cell-month {
        width: 22px;
        height: 22px;
    }
}

/* Edit Habits Page */
.habit-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--color-card);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 16px;
    transition: background 0.2s, box-shadow 0.2s, color 0.2s;
}
.habit-row:hover {
    background: var(--color-hover-alt);
}
.habit-name {
    flex-grow: 1;
    user-select: none;
}
.edit-input {
    flex-grow: 1;
    font-size: 1.1rem;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--color-edit-border);
    display: none;
    background: var(--color-card);
    color: var(--color-text-primary);
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}
/* Habit Edit Buttons */
.habit-button {
    color: var(--btn-text-default);
    border: none;
    padding: 6px 12px;
    margin-left: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    transition: transform 0.3s ease, opacity 0.3s ease, color 0.3s ease;
    /* Background ustawiany przez inline style="background: {{ button_gradient }}" */
}

.habit-button:hover {
    transform: translateY(-2px);
    opacity: 0.95;
}

.habit-button:focus-visible {
    outline: 2px solid var(--color-text-primary);
    outline-offset: 2px;
}
.add-form {
    margin-top: 30px;
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
}
.add-form input {
    padding: 10px 16px;
    font-size: 1rem;
    border: 1px solid var(--color-edit-border);
    border-radius: 8px;
    width: 200px;
    background: var(--color-card);
    color: var(--color-text-primary);
    transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.add-form button {
    border: none;
    color: var(--btn-text-default);
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: transform 0.3s ease, opacity 0.3s ease;
    /* Background ustawiany przez inline style="background: {{ button_gradient }}" */
}
.add-form button:hover {
    transform: translateY(-2px);
    opacity: 0.95;
}
.add-form button:focus-visible {
    outline: 2px solid var(--color-text-primary);
    outline-offset: 2px;
}
.section-title {
    margin-top: 40px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--color-border-light);
    padding-bottom: 4px;
    font-weight: 700;
    color: var(--color-text-primary);
    transition: border-color 0.3s, color 0.3s;
}
.archived .habit-row {
    background-color: var(--color-archived) !important;
    color: var(--color-archived-text) !important;
    box-shadow: none !important;
}
.archived .habit-row:hover {
    background-color: var(--color-archived-hover) !important;
}

/* Sleep Day Timeline Block Size */
.sleep-timeline-container .block {
    width: 48px;
    height: 60px;
}

/* Sleep Week/Month - Compact View */
.sleep-compact-view {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px 0;
}

.sleep-hour-line {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding: 0 0 8px 0;
    border-bottom: 1px solid var(--color-border);
    transition: border-color 0.3s ease;
}

.hour-line-spacer {
    width: 80px;
    flex-shrink: 0;
}

.hour-line-spacer-right {
    width: 70px;
    flex-shrink: 0;
}

.hour-line-labels {
    flex: 1;
    display: flex;
    justify-content: space-between;
    position: relative;
}

.hour-line-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-scale);
    opacity: 0.8;
    transition: color 0.3s ease;
}

.hour-line-middle {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.sleep-compact-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    transition: background-color 180ms ease;
    border-radius: 8px;
}

/* Hover effect for sleep rows (applies in both light and dark modes via CSS variables) */
.sleep-compact-row:hover {
    background-color: var(--sleep-hover-bg);
}

/* Tooltip centered above the sleep bar (.compact-bar-positioned) */
.compact-bar-positioned {
    position: absolute;
    height: 20px;
    border-radius: 6px;
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.compact-bar-positioned .sleep-tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 6px);
    transform: translateX(-50%);
    background: var(--sleep-tooltip-bg);
    color: var(--sleep-tooltip-color);
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: none;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}

/* Show tooltip when hovering the entire row */
.sleep-compact-row:hover .compact-bar-positioned .sleep-tooltip {
    visibility: visible;
    opacity: 1;
}

.compact-date {
    width: 80px;
    flex-shrink: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-tertiary);
    transition: color 0.3s ease;
}

.compact-slider {
    flex: 1;
    min-width: 0;
}

.slider-track-compact {
    display: flex;
    height: 20px;
    border-radius: 6px;
    background: var(--color-track);
    overflow: hidden;
    transition: background 0.3s ease;
}

.slider-segment-compact {
    flex: 1;
    min-width: 0;
    background: transparent;
}

.slider-segment-compact.slept {
    /* Background set by inline style with button_gradient */
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
}

.compact-duration {
    width: 70px;
    flex-shrink: 0;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-label);
    transition: color 0.3s ease;
}

.compact-bar-container {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    position: relative;
    height: 20px;
}

.compact-bar {
    width: 100%;
    height: 20px;
    border-radius: 6px;
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.compact-bar-positioned {
    position: absolute;
    height: 20px;
    border-radius: 6px;
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.compact-bar-empty {
    width: 100%;
    height: 20px;
    border-radius: 6px;
    background: var(--color-track);
    transition: background 0.3s ease;
}

.compact-hours-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    margin-bottom: 5px;
    border-bottom: 1px solid var(--color-border, #ddd);
}

.hour-label {
    position: absolute;
    font-size: 11px;
    color: var(--color-text-muted, #666);
    font-weight: 500;
}

/* Mobile adjustments for compact view */
@media (max-width: 768px) {
    .hour-line-spacer {
        width: 60px;
    }
    
    .hour-line-spacer-right {
        width: 55px;
    }
    
    .compact-date {
        width: 60px;
        font-size: 0.8rem;
    }
    
    .compact-duration {
        width: 55px;
        font-size: 0.8rem;
    }
    
    .slider-track-compact {
        height: 18px;
    }
}

/* Sleep Month/Week Table Block Size */
.week-table .block,
.month-table .block {
    width: 38px;
    height: 28px;
    border-radius: 6px;
    margin: 0 auto;
    background-color: var(--color-block);
    transition: background-color 0.3s ease;
}

.week-table .block.slept,
.month-table .block.slept {
    /* Background set by inline style with button_gradient */
    box-shadow: 0 2px 6px rgba(79, 172, 254, 0.3);
}

.week-table thead tr {
    height: 38px;
}
/* Authentication Forms */
.auth-form {
    width: 100%;
    max-width: 400px;
    margin: 30px auto;
    text-align: left;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--color-text-primary);
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid var(--color-input-border);
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
    background: var(--color-card);
    color: var(--color-text-primary);
}

.form-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    transition: color 0.3s ease;
}

.auth-form button.button {
    width: 100%;
    margin-top: 10px;
    cursor: pointer;
    border: none;
    font-family: 'Inter', sans-serif;
}

.auth-links {
    margin-top: 30px;
    text-align: center;
    font-size: 0.95rem;
}

.auth-links p {
    margin: 10px 0;
    font-size: 0.95rem;
}

.auth-links a {
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Messages/Alerts */
.messages {
    margin: 20px 0;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

/* 24-hour range slider for Sleep Day */
.range-slider-card {
    background: var(--color-card-alt);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: var(--shadow-card);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}
.range-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.range-title { margin: 0; font-size: 1.1rem; font-weight: 700; color: var(--color-text-primary); transition: color 0.3s ease; }
.range-summary { color: var(--color-text-label); font-weight: 600; font-size: 0.95rem; transition: color 0.3s ease; }

.time-slider { width: 100%; padding: 12px 4px 8px 4px; box-sizing: border-box; }
.time-slider .ticks { height: 18px; margin-bottom: 6px; position: relative; }
.time-slider .ticks::before { content: ''; display:block; height:1px; background:#e6eef6; width:100%; position: absolute; top:9px; left:0; }
.time-slider .track { position: relative; height: 34px; border-radius: 10px; background: var(--color-track); margin: 0 4px; transition: background 0.3s ease; }
.time-slider .selected-range { position: absolute; top: 6px; height: 22px; border-radius: 10px; transition: left 0.12s ease, width 0.12s ease, background 0.2s ease; }
.time-slider .selected-range:hover { opacity: 0.95; }
.time-slider .handle { position: absolute; top: 0; transform: translateX(-50%); width: 34px; height: 34px; border-radius: 50%; border: none; display:flex; align-items:center; justify-content:center; cursor:grab; transition: all 0.2s ease; color: var(--btn-text-default); }
.time-slider .handle:hover { transform: translateX(-50%) translateY(-2px); opacity: 0.95; }
.time-slider .handle:active { cursor:grabbing; }
.time-slider .handle:focus-visible { outline: 3px solid var(--color-text-primary); outline-offset: 2px; }
.handle-label { display:none; font-size:0.65rem; }

/* Time labels above slider */
.time-labels-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 0 4px;
}

.time-label {
    font-weight: 700;
    color: var(--color-text-tertiary);
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.time-label-start {
    text-align: left;
}

.time-label-end {
    text-align: right;
}

/* Duration label below slider */
.duration-container {
    margin-top: 10px;
    text-align: center;
}

.duration-label {
    font-weight: 600;
    color: var(--color-text-label);
    font-size: 1rem;
    transition: color 0.3s ease;
}

/* Scale labels below slider track */
.scale-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    padding: 0 4px;
}

.scale-time {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-scale);
    opacity: 0.8;
    transition: color 0.3s ease;
}

.scale-time.scale-middle {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* Tick marks: draw hourly ticks using repeating-linear-gradient as background for the ticks bar */
.time-slider .ticks { background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(100%/24 - 1px), rgba(74,90,106,0.06) calc(100%/24 - 1px), rgba(74,90,106,0.06) calc(100%/24)); background-size: 100% 100%; }

/* Mobile adjustments */
@media (max-width: 520px) {
    .time-slider .handle { width: 40px; height: 40px; }
    .time-slider .selected-range { top: 8px; height: 24px; }
    .time-label { font-size: 0.9rem; }
}

.alert-error {
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-success {
    background-color: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

.alert-info {
    background-color: #eef;
    color: #33c;
    border: 1px solid #ccf;
}

.alert-warning {
    background-color: #ffe;
    color: #cc3;
    border: 1px solid #ffc;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 30px 0;
}

.button-secondary {
    background: linear-gradient(90deg, #6c757d, #5a6268) !important;
}

.button-secondary:hover {
    background: linear-gradient(90deg, #5a6268, #495057) !important;
}

/* Features List */
.features {
    margin-top: 50px;
    text-align: left;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.features h2 {
    text-align: center;
    font-size: 1.8rem;
    color: var(--color-text-primary);
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.features ul {
    list-style: none;
    padding: 0;
}

.features li {
    padding: 12px 0;
    font-size: 1.05rem;
    color: var(--color-text-tertiary);
    line-height: 1.6;
    transition: color 0.3s ease;
}

/* User Menu */
.user-menu {
    position: absolute;
    top: 20px;
    right: 40px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    font-weight: 600;
    color: var(--color-text-primary);
    transition: color 0.3s ease;
}

.logout-button {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: var(--btn-text-default);
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.logout-button:hover {
    transform: translateY(-2px);
    opacity: 0.95;
}
/* ===========================
   FOOTER STYLES
   ========================= */

.app-footer {
    background: var(--color-navbar);
    border-top: 1px solid var(--color-border-light);
    padding: 30px 20px;
    margin-top: auto;
    box-shadow: none;
    width: 100%;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-center {
    justify-content: center;
    text-align: center;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 15px;
}

.footer-link {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
    font-weight: 500;
}

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

.footer-divider {
    color: var(--color-border-light);
}

/* Responsive footer */
@media (max-width: 600px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-links {
        justify-content: center;
    }
    
}