/* style.css */
:root {
    --bg-color-1: #E0F7FA;
    /* Pale Cyan/Blue */
    --bg-color-2: #E3F2FD;
    /* Pale Blue */
    --bg-color-3: #F3E5F5;
    /* Very subtle purple hint or just white? Let's stick to pale blues/whites */
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.9);
    --glass-blur: 20px;
    --text-primary: #263238;
    /* Dark Blue Grey */
    --text-secondary: #546E7A;
    --accent-color: #007AFF;
    /* iOS Blue */
    --danger-color: #FF3B30;
    /* iOS Red */
    --success-color: #34C759;
    /* iOS Green */
    --shadow-soft: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--bg-color-1), #3e8fca, #18517a);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

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

.glass-input {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 16px;
    width: 100%;
    outline: none;
    transition: background 0.3s;
}

.glass-input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-color);
}

.glass-button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.3s;
}

.glass-button:active {
    transform: scale(0.96);
}

.glass-button.secondary {
    background: rgba(255, 255, 255, 0.4);
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Burger Menu */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
}

.burger-menu-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 28px;
    cursor: pointer;
    z-index: 1000;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    z-index: 900;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.menu-overlay.open {
    opacity: 1;
    pointer-events: all;
}

/* Menu Grid System */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 90%;
    max-width: 600px;
    padding: 20px;
    max-height: 90vh;
    /* Allow slightly more height on mobile so it doesn't scroll inside the box as easily */
    overflow-y: auto;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

@media (max-width: 600px) {
    .menu-grid {
        gap: 10px;
        padding: 10px;
        width: 95%;
    }

    .menu-tile {
        padding: 10px;
    }

    .menu-tile i {
        font-size: 24px;
        margin-bottom: 5px;
    }

    .menu-tile span {
        font-size: 12px;
    }
}

.menu-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    aspect-ratio: 1;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
    padding: 15px;
    text-align: center;
}

.menu-tile i {
    font-size: 32px;
    margin-bottom: 10px;
    color: var(--accent-color);
}

.menu-tile span {
    font-size: 14px;
    font-weight: 500;
}

.menu-tile:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.menu-tile.danger i {
    color: var(--danger-color);
}

.menu-tile.danger span {
    color: var(--danger-color);
}

/* Copy Group Button (End) */

/* Planner Styles */
.sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background: var(--bg-color-1);
    /* Fallback */
    background: linear-gradient(135deg, var(--bg-color-1), var(--bg-color-2));
    padding-bottom: 10px;
    padding-bottom: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#planner-header-content {
    min-height: 40px;
    /* Fixed height to prevent jumping */
    display: flex;
    align-items: center;
    justify-content: center;
}

.segmented-control-container {
    padding: 0 20px 10px 20px;
    display: flex;
    justify-content: center;
}

.segmented-control {
    background: rgba(118, 118, 128, 0.12);
    border-radius: 9px;
    padding: 2px;
    display: flex;
    width: 100%;
    max-width: 400px;
    position: relative;
    /* For absolute positioning of the slider */
}

/* The sliding white background */
#segment-indicator {
    position: absolute;
    top: 2px;
    left: 2px;
    width: calc(50% - 2px);
    height: calc(100% - 4px);
    background: white;
    border-radius: 7px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1;
    pointer-events: none;
    /* Let clicks pass through to the buttons */
}

.segment {
    flex: 1;
    text-align: center;
    padding: 6px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    position: relative;
    z-index: 2;
    /* Above the slider */
    transition: color 0.3s;
    user-select: none;
}

.segment.active {
    /* No background change here, the slider handles it. But we ensure text color is correct. */
    color: black;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    margin-bottom: 10px;
}

.checklist-cb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.checklist-cb.checked {
    background: var(--accent-color);
    color: white;
}

/* Compact Inputs and Rows for Settings */
.list-item-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.list-item-row:last-child {
    border-bottom: none;
}

.glass-input.compact {
    padding: 8px 12px;
    font-size: 14px;
    height: 40px;
}

.glass-button.compact {
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-link:hover,
.menu-link.active {
    background: rgba(0, 0, 0, 0.05);
}

/* Grid for Tiles */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    padding: 10px 0;
}

.tile {
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    aspect-ratio: 1;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    transition: transform 0.2s, background 0.3s;
    position: relative;
}

.tile:hover {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.8);
}

/* Group Tile Specifics */
.group-tile {
    position: relative;
    overflow: hidden;
    /* For ribbons/badges in corners if needed */
    justify-content: flex-start;
    /* Align top */
    padding-top: 40px;
    /* Space for module badge */
    padding-bottom: 40px;
    /* Space for room badge at bottom */
}

.module-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--accent-color);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.today-highlight {
    border: 2px solid var(--accent-color);
    background: rgba(255, 255, 255, 0.75);
    /* Slightly more opaque/bright */
    box-shadow: 0 0 15px rgba(0, 122, 255, 0.3);
    /* Glow */
    order: -1;
    /* Flex/Grid order handling if used, but JS sort handles it too. */
}

/* Room Badge at Bottom Left */
.room-badge {
    position: absolute;
    top: auto;
    bottom: 10px;
    left: 10px;
    background: #607D8B;
    /* Blue Grey */
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Blinking Today Badge at Top Left */
@keyframes blink {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.05);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.today-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--success-color);
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    z-index: 5;
    animation: blink 2s infinite ease-in-out;
    box-shadow: 0 0 10px rgba(52, 199, 89, 0.6);
}

.badge-room {
    background: var(--text-secondary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
}

.copy-group-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.copy-group-btn:hover {
    background: var(--accent-color);
    color: white;
    transform: scale(1.1);
}

.tile-icon {
    font-size: 32px;
    margin-bottom: 10px;
    color: var(--accent-color);
}

.tile-title {
    font-size: 14px;
    word-break: break-word;
}

/* Updated controls matching app.js */
.tile-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    z-index: 10;
}

.tile-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--glass-border);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.tile-btn:hover {
    background: white;
    color: var(--accent-color);
    transform: scale(1.1);
}

.tile-btn.delete-btn:hover {
    color: var(--danger-color);
}


/* Login Page specific */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

.login-box {
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s;
}

/* Utility to ensure elements are hidden by default if needed */
.hidden {
    display: none !important;
}