/* ===== BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.5s ease;
}

/* ===== THEMES ===== */
body.night  { background: linear-gradient(135deg, #1d2671, #c33764); }
body.sunset { background: linear-gradient(135deg, #ff7e5f, #feb47b); }
body.ocean  { background: linear-gradient(135deg, #2193b0, #6dd5ed); }
body.purple { background: linear-gradient(135deg, #654ea3, #eaafc8); }

/* ===== APP SHELL ===== */
.app {
    width: 370px;
    height: 680px;
    border-radius: 28px;
    padding: 14px;
    backdrop-filter: blur(25px);
    background: rgba(255,255,255,0.15);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===== TOP BAR — scrollable strips ===== */
.top-bar {
    display: flex;
    gap: 6px;
}

.top-bar-scroll {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    padding: 5px 10px;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    user-select: none;
}

.top-bar-scroll::-webkit-scrollbar { display: none; }
.top-bar-scroll:active { cursor: grabbing; }

.scroll-label {
    font-size: 13px;
    flex-shrink: 0;
    opacity: 0.9;
}

.scroll-option {
    font-size: 11px;
    color: white;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 3px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.2s;
    opacity: 0.8;
}

.scroll-option:hover { opacity: 1; background: rgba(255,255,255,0.2); }
.scroll-option.active-sound,
.scroll-option.active-theme {
    background: rgba(255,255,255,0.35);
    opacity: 1;
    font-weight: 600;
}

/* ===== HEADER CARD ===== */
.header-card {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(20px);
    padding: 12px 14px;
    border-radius: 20px;
    color: white;
    flex-shrink: 0;
}

.header-card h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
}

/* ===== STATS ===== */
.stats {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 8px;
}

/* ===== FILTER BUTTONS ===== */
.filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filters button {
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(255,255,255,0.25);
    color: white;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: 0.25s;
    font-weight: 500;
}

.filters button:hover,
.filters button.active-filter {
    background: rgba(255,255,255,0.5);
    color: #333;
}

/* ===== SEARCH ===== */
#search {
    width: 100%;
    padding: 9px 13px;
    border-radius: 12px;
    border: none;
    background: rgba(255,255,255,0.85);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    outline: none;
    flex-shrink: 0;
}

/* ===== TASK LIST ===== */
#taskList {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#taskList::-webkit-scrollbar { width: 3px; }
#taskList::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.35);
    border-radius: 3px;
}

/* ===== TASK CARD ===== */
#taskList li {
    background: rgba(255,255,255,0.92);
    border-radius: 14px;
    padding: 11px 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.3s, opacity 0.3s;
    animation: slideIn 0.3s ease;
    cursor: grab;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

#taskList li:active { cursor: grabbing; }
#taskList li:hover  { transform: scale(1.01); }

#taskList li span {
    user-select: none;
    font-size: 13px;
    color: #222;
    font-weight: 500;
    flex: 1;
    cursor: pointer;
}

#taskList li div {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

#taskList li div button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

#taskList li div button:first-child { background: #ff69b4; color: white; }
#taskList li div button:last-child  { background: #ff4757; color: white; }
#taskList li div button:hover { transform: scale(1.15); }

/* ===== COMPLETED ===== */
.completed {
    text-decoration: line-through;
    opacity: 0.45;
}

/* ===== FAB ===== */
.fab {
    position: absolute;
    bottom: 18px;
    right: 18px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #ff416c, #ff4b2b);
    color: white;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(255,65,108,0.5);
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    line-height: 1;
}

.fab:hover { transform: scale(1.1) rotate(90deg); }

/* ===== OVERLAY ===== */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.25);
    z-index: 15;
    border-radius: 28px;
}

/* ===== BOTTOM SHEET ===== */
.bottom-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 82%;
    overflow-y: auto;
    background: white;
    padding: 18px 16px;
    border-radius: 22px 22px 0 0;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
    z-index: 20;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.12);
}

.bottom-sheet:not(.hidden) { transform: translateY(0); }

.bottom-sheet h3 {
    font-size: 17px;
    font-weight: 700;
    color: #222;
    margin-bottom: 12px;
}

.bottom-sheet input,
.bottom-sheet select {
    width: 100%;
    box-sizing: border-box;
    margin: 6px 0;
    padding: 11px 13px;
    border-radius: 11px;
    border: 1.5px solid #eee;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    background: #f9f9f9;
    color: #333;
    outline: none;
    transition: border 0.2s;
}

.bottom-sheet input:focus,
.bottom-sheet select:focus {
    border-color: #ff416c;
    background: white;
}

.sheet-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-add {
    flex: 1;
    padding: 11px;
    border-radius: 13px;
    border: none;
    background: linear-gradient(135deg, #ff416c, #ff4b2b);
    color: white;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: 0.2s;
}

.btn-cancel {
    flex: 1;
    padding: 11px;
    border-radius: 13px;
    border: none;
    background: #f0f0f0;
    color: #555;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: 0.2s;
}

.btn-add:hover    { opacity: 0.9; transform: scale(1.02); }
.btn-cancel:hover { background: #e5e5e5; transform: scale(1.02); }

/* ===== REMINDER POPUP ===== */
.popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1a1a2e;
    color: white;
    padding: 16px 18px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    z-index: 999;
    max-width: 270px;
    border-left: 4px solid #ff416c;
}

.popup.hidden { display: none; }

.popup p {
    font-size: 13px;
    margin-bottom: 10px;
    line-height: 1.5;
}

.popup-actions {
    display: flex;
    gap: 8px;
}

.popup-actions button {
    flex: 1;
    padding: 8px;
    border-radius: 10px;
    border: none;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    cursor: pointer;
}

.popup-actions button:first-child { background: #ff416c; color: white; }
.popup-actions button:last-child  { background: rgba(255,255,255,0.15); color: white; }

/* ===== EMPTY STATE ===== */
#emptyMsg {
    text-align: center;
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    margin-top: 20px;
    display: none;
    line-height: 1.8;
}

.empty-icon { font-size: 36px; }

/* ===== CALENDAR VIEW ===== */
#calendarView {
    width: 100%;
    overflow-y: auto;
    flex: 1;
}

.cal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 4px;
    color: white;
}

.cal-header h3 { font-size: 15px; font-weight: 600; }

.cal-header button {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    padding: 0;
}

.cal-header button:hover { background: rgba(255,255,255,0.35); }

#calGrid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-top: 6px;
}

.cal-day-label {
    text-align: center;
    font-size: 10px;
    color: rgba(255,255,255,0.65);
    font-weight: 600;
    padding: 3px 0;
}

.cal-day {
    aspect-ratio: 1;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.85);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    font-family: 'Inter', sans-serif;
    padding: 0;
    position: relative;
}

.cal-day:hover { background: rgba(255,255,255,0.2); }

.cal-day.cal-today {
    background: rgba(255,255,255,0.35);
    font-weight: 700;
}

.cal-day.cal-selected {
    background: linear-gradient(135deg, #ff416c, #ff4b2b);
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(255,65,108,0.4);
}

/* ===== CALENDAR TASK PANEL ===== */
.cal-task-panel {
    background: rgba(255,255,255,0.15);
    border-radius: 14px;
    padding: 10px 12px;
    margin-top: 8px;
}

.cal-task-panel h4 {
    color: white;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    opacity: 0.9;
}

.cal-task-panel ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cal-task-panel ul li {
    background: rgba(255,255,255,0.9);
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #222;
    font-weight: 500;
}

.cal-task-panel .no-tasks {
    color: rgba(255,255,255,0.6);
    font-size: 12px;
    text-align: center;
    padding: 6px 0;
}

.priority-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cal-task-time {
    margin-left: auto;
    font-size: 11px;
    color: #888;
    flex-shrink: 0;
}

/* ===== HIDDEN ===== */
.hidden { display: none !important; }

/* ===== DATE PICKER ===== */
#datePicker {
    position: relative;
    width: 100%;
}

#miniCal {
    position: absolute;
    top: 46px;
    left: 0;
    width: 100%;
    background: white;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    z-index: 100;
    border: 1.5px solid #eee;
}

.mini-cal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.mini-cal-header span {
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

.mini-cal-header button {
    background: #f0f0f0;
    color: #333;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#miniCalGrid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

#miniCalGrid .cal-day {
    color: #333;
    font-size: 11px;
    border-radius: 6px;
    aspect-ratio: 1;
}

#miniCalGrid .cal-day:hover { background: rgba(255,65,108,0.12); }
#miniCalGrid .cal-day-label { color: #aaa; font-size: 10px; }

/* ===== ANIMATIONS ===== */
@keyframes slideIn {
    from { transform: translateY(14px); opacity: 0; }
    to   { transform: translateY(0);   opacity: 1; }
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 480px) {
    body {
        align-items: flex-start;
        justify-content: flex-start;
        padding: 0;
    }

    .app {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
        padding: 12px;
        gap: 8px;
    }

    .fab {
        bottom: 24px;
        right: 16px;
        width: 56px;
        height: 56px;
        font-size: 28px;
    }

    .bottom-sheet {
        max-height: 90%;
        padding: 20px 16px;
        border-radius: 20px 20px 0 0;
    }

    .filters button {
        padding: 6px 10px;
        font-size: 11px;
    }

    #search {
        padding: 10px 12px;
        font-size: 14px;
    }

    #taskList li span {
        font-size: 13px;
    }

    .popup {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: unset;
    }
}
