/* css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --bg-gradient: linear-gradient(135deg, #fefefe 0%, #f0f4f8 100%);
    --card-bg: #FFFFFF;
    --primary: #4CBABB;
    --accent: #FF6B6B;
    --bg-light: #F5F7FA;
    --glass-border: rgba(0, 0, 0, 0.05);
    --text-dark: #2D3436;
    --text-muted: #636E72;
    --bubble-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);

    /* Category Colors - Based on Screenshot */
    --color-morning: #FFF9E6;
    --color-morning-text: #B38F00;
    --color-midday: #E6F4FF;
    --color-midday-text: #0077D6;
    --color-evening: #E6FFF9;
    --color-evening-text: #008F68;
    --color-night: #F0F2FF;
    --color-night-text: #3D5AFE;

    /* Child colors are now dynamic from app.js */
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    height: 100vh;
    color: var(--text-dark);
    overflow: hidden;
    display: flex;
}

#app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar - Slimmer & Cleaner */
nav.sidebar {
    width: 80px;
    background: #FFFFFF;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 0;
    border-right: 1px solid var(--glass-border);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 700;
}

.nav-item.active,
.nav-item:hover {
    color: var(--primary);
    transform: translateY(-2px);
}

.nav-icon {
    font-size: 1.5rem;
    padding: 8px;
    border-radius: 14px;
    background: transparent;
    transition: background 0.2s;
}

.nav-item.active .nav-icon {
    background: rgba(76, 186, 187, 0.1);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

header {
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
}

.title-container h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: #4A90E2;
}

main {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1;
    overflow-y: auto;
}

.main-view-container {
    padding: 0;
    width: 100%;
    height: 100%;
}

/* Dashboard Grid */
/* Dashboard Grid - Ultra Compact for Tablet */
.family-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    height: 100%;
    padding: 20px;
}

.child-column {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: none;
    overflow-y: auto;
}

.child-header {
    padding: 15px 5px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(5px);
    border-radius: 24px;
    padding: 12px 15px;
    margin-bottom: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.child-avatar-large {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #FFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.child-name-large {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 2px;
}

.child-points-large {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.7;
    margin-bottom: 10px;
}

/* Category Sections */
.category-section {
    padding: 10px 20px 20px;
}

.category-title {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 15px;
    padding-left: 2px;
    color: var(--text-muted);
}

/* Task Cards - Ultra Compact */
.modern-task-card {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 8px 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
    cursor: pointer;
    transition: all 0.2s ease;
    cursor: pointer;
    min-height: 60px;
}

.modern-task-card:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.modern-task-card.completed {
    opacity: 0.5;
}

.task-main-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.task-icon-bg {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
}

.task-name {
    font-size: 1rem;
    font-weight: 700;
    color: #2D3436;
    line-height: 1.2;
}

.modern-check {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3.5px solid #F0F2F5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFF;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: transparent;
    font-weight: 800;
    font-size: 1rem;
    flex-shrink: 0;
    margin-left: 10px;
}

.completed .modern-check {
    background: var(--primary);
    border-color: var(--primary);
    color: #FFF;
    transform: scale(1.1);
}

/* Settings Overhaul */
.settings-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px;
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.settings-group {
    background: #FFFFFF;
    border-radius: 32px;
    padding: 35px;
    box-shadow: var(--bubble-shadow);
    border: 1px solid var(--glass-border);
    flex: 1;
    min-width: 350px;
}

.settings-group.full-width {
    flex: 1 1 100% !important;
}

.settings-group.half-width {
    flex: 1 1 calc(50% - 30px);
    min-width: 350px;
}

.settings-group h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center section titles */
    gap: 12px;
}

/* Form Elements */
.modern-input-group {
    margin-bottom: 20px;
}

.modern-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-left: 5px;
}

.modern-input,
.modern-select {
    width: 100%;
    padding: 16px 20px;
    border-radius: 18px;
    border: 2px solid #F0F2F5;
    background: #F8FAFC;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.modern-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23636E72' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    padding-right: 45px;
}

.modern-input:focus,
.modern-select:focus {
    border-color: var(--primary);
    background: #FFF;
    box-shadow: 0 0 0 5px rgba(76, 186, 187, 0.12);
}

.modern-btn {
    padding: 16px 30px;
    border-radius: 18px;
    border: none;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.primary-btn {
    background: var(--primary);
    color: #FFF;
    box-shadow: 0 8px 20px rgba(76, 186, 187, 0.3);
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(76, 186, 187, 0.4);
}

.secondary-btn {
    background: #F0F2F5;
    color: #2D3436;
}

.secondary-btn:hover {
    background: #E6E9EF;
}

/* Lists and Items */
.modern-list {
    margin-top: 15px;
}

.modern-list-item {
    padding: 18px;
    border-radius: 20px;
    background: #F8FAFC;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(0, 0, 0, 0.02);
    transition: background 0.2s;
}

.modern-list-item:hover {
    background: #F3F5F9;
}

.settings-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.item-info {
    display: flex;
    gap: 15px;
    align-items: center;
}

.item-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #FFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.item-text h4 {
    font-size: 1rem;
    font-weight: 750;
    margin-bottom: 2px;
}

.item-text p {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: none;
    background: #FFF;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.delete-btn:hover {
    background: #FFE5E5;
    color: #FF6B6B;
}

/* Calendar & General Views */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 0 40px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    padding: 0 40px 100px;
}

.full-view {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Rewards Grid */
.rewards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    padding: 40px;
}

.reward-card {
    background: #FFF;
    border-radius: 32px;
    padding: 30px;
    text-align: center;
    box-shadow: var(--bubble-shadow);
    border: 1px solid var(--glass-border);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.reward-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
}

/* Floating Action Button - Removed from CSS as it will be removed from JS */
.fab {
    display: none;
}

/* Status Circles */
.modern-status-circles {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.modern-status-ring {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    border: 3.5px solid transparent;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

/* Day Selector */
.day-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.day-checkbox {
    display: none;
}

.day-label {
    padding: 10px 15px;
    border-radius: 12px;
    background: #F0F2F5;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.day-checkbox:checked+.day-label {
    background: var(--primary);
    color: #FFF;
    transform: scale(1.05);
}

/* Animations */
@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

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

.animate-up {
    animation: slideUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}


/* MOBILE: max 768px */
@media screen and (max-width: 768px) {
    nav.sidebar {
        width: 100%;
        height: 80px;
        position: fixed;
        bottom: 0;
        left: 0;
        flex-direction: row;
        justify-content: space-evenly;
        padding: 0 10px;
        border-right: none;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.03);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(12px);
        z-index: 1000;
    }

    .nav-item {
        margin-bottom: 0;
        justify-content: center;
        flex: 1;
        gap: 2px;
    }

    .nav-item span:not(.nav-icon) {
        font-size: 0.65rem;
        font-weight: 700;
    }

    .nav-icon {
        font-size: 1.6rem;
        padding: 8px;
        border-radius: 12px;
    }

    .main-content {
        padding-bottom: 90px;
    }

    header {
        padding: 15px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .title-container h1 {
        font-size: 1.5rem;
    }

    .view-header {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center;
        padding: 20px !important;
        gap: 15px !important;
    }

    .view-header title-container,
    .view-header>div {
        text-align: center !important;
    }

    .view-header .meals-nav-buttons {
        margin-right: 0 !important;
    }

    .calendar-grid {
        padding: 0 15px 100px !important;
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .family-columns {
        display: flex !important;
        flex-direction: column !important;
        gap: 30px;
        padding: 15px;
        padding-bottom: 120px;
    }

    .settings-list-grid {
        grid-template-columns: 1fr !important;
    }

    .child-column {
        height: auto;
        overflow: visible;
        border-bottom: 2px dashed rgba(0, 0, 0, 0.05);
        padding-bottom: 25px;
    }

    .child-column:last-child {
        border-bottom: none;
    }

    .child-header {
        position: relative;
        top: 0;
        margin-bottom: 15px;
        border-radius: 20px;
        z-index: 1;
    }

    .settings-container {
        padding: 15px;
        gap: 20px;
    }

    .settings-group {
        padding: 25px 20px;
        min-width: 100%;
        border-radius: 24px;
    }

    .modern-modal {
        width: 92%;
        padding: 25px;
        max-height: 85vh;
        overflow-y: auto;
    }

    .meals-header {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center;
        gap: 15px;
        padding: 20px !important;
    }

    .meals-header h2 {
        font-size: 1.25rem !important;
    }

    .meals-nav-buttons {
        width: 100%;
        justify-content: center;
        gap: 10px;
    }
}

/* TABLET: Simple fix - remove internal scroll */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .family-columns {
        height: auto !important;
        min-height: 100vh;
    }

    .child-column {
        height: auto !important;
        overflow-y: visible !important;
        padding-bottom: 150px;
    }
}

.meals-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 40px;
    border-radius: 28px;
}

.meals-nav-buttons {
    display: flex;
    gap: 15px;
}

/* MODAL STYLES - Fix transparency and add alert styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modern-modal {
    background: #FFFFFF !important;
    padding: 40px;
    border-radius: 32px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.12);
    max-width: 550px;
    width: 90%;
    display: flex;
    flex-direction: column;
    position: relative;
    opacity: 1 !important;
    transform: translateY(0);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
}

/* Added Grid System for Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px 20px;
    width: 100%;
    margin-bottom: 20px;
}

.form-grid>.full-width {
    grid-column: span 2;
}

/* Ensure labels inside grid don't overlap and have proper weight */
.form-grid label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    color: #4A5568;
}

@media screen and (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr !important;
    }
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 10px;
}

.form-grid>.full-width {
    grid-column: span 2;
}

.modern-modal {
    max-width: 500px;
    width: 95%;
    background: #FFF;
    padding: 40px;
    border-radius: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow-y: auto;
    max-height: 90vh;
    text-align: center;
    /* Global centering for modals */
}

.modal-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 25px;
    width: 100%;
}

.modal-buttons-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    width: 100%;
}

.modal-buttons-row .modern-btn {
    flex: 1;
}

.modern-modal .modern-label {
    text-align: center;
    padding-left: 0;
}

.modern-modal h2,
.modern-modal h3 {
    margin-bottom: 25px;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-dark);
    text-align: center;
}

.color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.color-option {
    width: 35px;
    height: 35px;
    border-radius: 10px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.color-option.selected {
    border-color: var(--primary);
    transform: scale(1.1);
}