/* ========================================
   365 Habit Tracker - Styles
   ======================================== */

/* CSS Variables */
:root {
    --color-bg: #ffffff;
    --color-text: #1a1a1a;
    --color-grid: #1a1a1a;
    --color-empty: #1a1a1a;
    --color-started: #2E8B7B;
    --color-completed: #C44536;
    --color-hover: #f5f5f5;

    --font-family: 'Space Mono', monospace;
    --cell-size: 80px;
    --side-column: 40px;
    --grid-gap: 0;
    --border-width: 2px;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 50px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0px 0px;
    width: 100%;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    cursor: pointer;
    transition: opacity 0.2s ease;
    margin-left: -165px;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.logo-number {
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: -2px;
}

.logo-days {
    font-size: 1.3rem;
    font-weight: 400;
    letter-spacing: 3px;
    margin-top: -5px;
    margin-left: 27px;
}

.logo:hover {
    opacity: 0.6;
}

.btn-log-year {
    font-family: var(--font-family);
    font-size: 1.2rem;
    font-weight: 400;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-text);
    letter-spacing: 3px;
    cursor: pointer;
    color: var(--color-text);
    letter-spacing: 3px;
    -webkit-tap-highlight-color: transparent;
}

.btn-log,
.btn-year {
    transition: opacity 0.2s ease, font-weight 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-log:hover,
.btn-year:hover {
    opacity: 0.6;
}

.btn-year.active {
    font-weight: 700;
}

/* Calendar Section */
.calendar-section {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 40px;
}

/* Navigation Arrows */
.nav-arrow {
    display: none;
}

.nav-arrow:hover {
    opacity: 0.6;
}

.arrow-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.arrow-icon--left {
    transform: rotate(180deg);
}

/* Calendar Container */
.calendar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Month Display */
.month-display {
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 3px;
    margin-bottom: 25px;
    text-align: center;
}

/* Calendar Header (Day names) */
.calendar-header {
    display: grid;
    grid-template-columns: var(--side-column) repeat(7, var(--cell-size)) var(--side-column);
    border-bottom: var(--border-width) solid var(--color-grid);
}

.day-header {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 1px;
    border-left: var(--border-width) solid var(--color-grid);
}

.day-header:first-child {
    border-left: none;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: var(--side-column) repeat(7, var(--cell-size)) var(--side-column);
}

/* Day Cell */
.day-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: var(--border-width) solid var(--color-grid);
    border-bottom: var(--border-width) solid var(--color-grid);
    cursor: pointer;
    transition: background-color 0.15s ease;
    position: relative;
}

.day-cell:nth-child(9n + 1) {
    /* First column (empty) */
    border-left: none;
}

.day-cell:hover:not(.day-cell--empty) {
    background-color: var(--color-hover);
}

.day-cell--empty {
    cursor: default;
    aspect-ratio: auto;
    height: var(--cell-size);
}

.day-cell--side {
    width: var(--side-column);
    aspect-ratio: auto;
    height: var(--cell-size);
}

.day-cell--bottom {
    height: 15px;
    border-bottom: none;
}

/* Today highlight - soft fill */
.day-cell--today {
    background-color: rgba(26, 26, 26, 0.08);
}

/* Future cells - not clickable */
.day-cell--future {
    cursor: default;
}

.day-cell--future:hover {
    background-color: transparent;
}

/* Habit States */
.habit-marker {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.day-cell:not(.day-cell--empty):hover .habit-marker {
    transform: scale(1.1);
}

/* Empty state - hollow circle */
.habit-marker--empty {
    width: 28px;
    height: 28px;
    border: 2px solid var(--color-empty);
    border-radius: 50%;
}

/* Started state - filled green circle */
.habit-marker--started {
    width: 28px;
    height: 28px;
    background-color: var(--color-started);
    border-radius: 50%;
}

/* Completed state - red star */
.habit-marker--completed {
    width: 28px;
    height: 28px;
    font-size: 2.5rem;
    color: var(--color-completed);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.habit-marker--completed::before {
    content: '★';
    display: block;
    transform: translateY(-6px);
}

/* Bailout state - man.webp icon (day saved by bailout) */
.habit-marker--bailout {
    width: 28px;
    height: 28px;
    background-image: url('../images/man.webp');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 20px 10px;
    }

    .app-container {
        gap: 30px;
    }

    /* Header - remove negative margins for mobile */
    .logo {
        margin-left: 30px;
    }

    .logo-number {
        font-size: 3rem;
    }

    .logo-days {
        font-size: 1rem;
        margin-left: 20px;
    }

    .btn-log-year {
        margin-right: 0;
        font-size: 1rem;
    }

    .header {
        padding: 0 15px;
        width: calc(100% - 30px);
    }

    /* Calendar Section - stack Today below calendar on mobile */
    .calendar-section {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }

    /* Today Section - full width on mobile */
    .today-section {
        width: 100%;
        max-width: 400px;
        min-width: auto;
        margin-top: 0;
        padding: 0;
    }

    .today-header {
        font-size: 1rem;
    }
}

@media (max-width: 600px) {
    :root {
        --cell-size: 45px;
        --side-column: 25px;
    }

    body {
        padding: 15px 5px;
    }

    .logo-number {
        font-size: 2.5rem;
    }

    .logo-days {
        font-size: 0.9rem;
        margin-left: 15px;
        letter-spacing: 2px;
    }

    .btn-log-year {
        font-size: 0.85rem;
        letter-spacing: 2px;
    }

    .calendar-section {
        gap: 20px;
    }

    .day-header {
        font-size: 0.6rem;
        height: 30px;
        letter-spacing: 0;
    }

    .habit-marker {
        width: 16px;
        height: 16px;
    }

    .habit-marker--empty {
        width: 14px;
        height: 14px;
    }

    .habit-marker--started {
        width: 16px;
        height: 16px;
    }

    .habit-marker--completed {
        width: 16px;
        height: 16px;
        font-size: 1.8rem;
    }

    .habit-marker--completed::before {
        transform: translateY(-0.15em);
    }

    .habit-marker--bailout {
        width: 16px;
        height: 16px;
    }

    /* Today section mobile */
    .today-goal-checkbox {
        width: 20px;
        height: 20px;
    }

    .today-goal-text {
        font-size: 0.85rem;
    }

    .today-legend {
        gap: 15px;
    }

    .today-legend-item {
        font-size: 0.7rem;
    }

    /* User menu buttons */
    .logout-cross,
    .menu-btn {
        font-size: 1.4rem;
    }

    .menu-btn {
        margin-right: 30px;
    }
}

@media (max-width: 400px) {
    :root {
        --cell-size: 38px;
        --side-column: 15px;
    }

    .logo-number {
        font-size: 2rem;
    }

    .logo-days {
        font-size: 0.8rem;
        margin-left: 10px;
    }

    .header {
        padding: 0;
    }

    .app-container {
        gap: 20px;
    }

    .btn-log-year {
        font-size: 0.75rem;
    }

    .day-header {
        font-size: 0.5rem;
    }

    .habit-marker {
        width: 14px;
        height: 14px;
    }

    .habit-marker--empty {
        width: 12px;
        height: 12px;
    }

    .habit-marker--started {
        width: 14px;
        height: 14px;
    }

    .habit-marker--completed {
        width: 14px;
        height: 14px;
        font-size: 1.5rem;
    }

    .habit-marker--completed::before {
        transform: translateY(-0.15em);
    }

    .month-display {
        font-size: 0.9rem;
        letter-spacing: 2px;
    }
}

/* ========================================
   Year View Styles
   ======================================== */

.year-section {
    display: none;
    width: 100%;
    padding: 0 20px;
}

.year-section.active {
    display: block;
}

.calendar-section.hidden {
    display: none;
}

.year-grid {
    display: inline-grid;
    grid-template-columns: repeat(4, auto);
    column-gap: 25px;
    row-gap: 25px;
}

.year-section.active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Mini Month in Year View */
.mini-month {
    background-color: var(--color-bg);
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.mini-month:hover {
    opacity: 0.8;
}

/* Mini month row structure with side columns */
.mini-month-row {
    display: grid;
    grid-template-columns: 10px repeat(7, 35px) 10px;
}

/* Top/bottom extension rows for lines sticking out */
.mini-month-extension {
    display: grid;
    grid-template-columns: 10px repeat(7, 35px) 10px;
    height: 8px;
}

.mini-ext-cell {
    border-left: 1px solid var(--color-grid);
}

.mini-ext-cell:first-child,
.mini-ext-cell:last-child {
    border-left: none;
}

.mini-ext-cell:nth-child(8) {
    border-right: 1px solid var(--color-grid);
}

.mini-month-extension--top {
    border-bottom: 1px solid var(--color-grid);
}

.mini-month-extension--bottom {
    /* No border-top to avoid double line with last row's border-bottom */
    border-top: none;
}

/* Day cells */
.mini-day {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--color-grid);
    border-bottom: 1px solid var(--color-grid);
}

.mini-day:first-child {
    border-left: none;
}

/* Last day cell (8th child = 7th day after left side) gets right border */
.mini-day:nth-child(8) {
    border-right: 1px solid var(--color-grid);
}

/* Side columns - only horizontal lines, no vertical */
.mini-day--side {
    width: 10px;
    height: 35px;
    border-bottom: 1px solid var(--color-grid);
    border-left: none;
}

/* Mini Habit Markers */
.mini-marker {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-marker--empty {
    width: 15px;
    height: 15px;
    border: 1px solid var(--color-empty);
    border-radius: 50%;
}

.mini-marker--started {
    width: 18px;
    height: 18px;
    background-color: var(--color-started);
    border-radius: 50%;
}

.mini-marker--completed {
    width: 18px;
    height: 18px;
    font-size: 1.8rem;
    color: var(--color-completed);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 3px;
}

.mini-marker--completed::before {
    content: '★';
    display: block;
    transform: translateY(-2px);
}

/* Mini Bailout state - man.webp icon for year view */
.mini-marker--bailout {
    width: 18px;
    height: 18px;
    background-image: url('../images/man.webp');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Year View Responsive */
@media (max-width: 900px) {
    .year-grid {
        grid-template-columns: repeat(3, 1fr);
        column-gap: 15px;
        row-gap: 20px;
    }
}

@media (max-width: 768px) {
    .year-section {
        padding: 0 10px;
    }

    .bailouts-container {
        margin-right: 0 !important;
        align-self: center !important;
        width: auto;
        justify-content: center;
        margin-top: 20px;
    }

    .mini-month-row {
        grid-template-columns: 8px repeat(7, 28px) 8px;
    }

    .mini-month-extension {
        grid-template-columns: 8px repeat(7, 28px) 8px;
        height: 6px;
    }

    .mini-day {
        width: 28px;
        height: 28px;
    }

    .mini-day--side {
        width: 8px;
        height: 28px;
    }

    .mini-marker {
        width: 14px;
        height: 14px;
    }

    .mini-marker--empty {
        width: 12px;
        height: 12px;
    }

    .mini-marker--started {
        width: 14px;
        height: 14px;
    }

    .mini-marker--completed {
        width: 14px;
        height: 14px;
        font-size: 1.3rem;
    }

    .mini-marker--completed::before {
        transform: none;
    }

    .mini-marker--bailout {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 600px) {
    .year-grid {
        grid-template-columns: repeat(2, 1fr);
        column-gap: 10px;
        row-gap: 15px;
    }

    .mini-month-row {
        grid-template-columns: 6px repeat(7, 22px) 6px;
    }

    .mini-month-extension {
        grid-template-columns: 6px repeat(7, 22px) 6px;
        height: 5px;
    }

    .mini-day {
        width: 22px;
        height: 22px;
    }

    .mini-day--side {
        width: 6px;
        height: 22px;
    }

    .mini-marker {
        width: 10px;
        height: 10px;
    }

    .mini-marker--empty {
        width: 8px;
        height: 8px;
    }

    .mini-marker--started {
        width: 10px;
        height: 10px;
    }

    .mini-marker--completed {
        width: 10px;
        height: 10px;
        font-size: 1rem;
    }

    .mini-marker--completed::before {
        transform: none;
    }

    .mini-marker--bailout {
        width: 10px;
        height: 10px;
    }

    .bailouts-label {
        font-size: 1rem;
    }

    .bailout-heart {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 400px) {
    .year-grid {
        grid-template-columns: repeat(2, 1fr);
        column-gap: 8px;
        row-gap: 12px;
    }

    .mini-month-row {
        grid-template-columns: 5px repeat(7, 18px) 5px;
    }

    .mini-month-extension {
        grid-template-columns: 5px repeat(7, 18px) 5px;
        height: 4px;
    }

    .mini-day {
        width: 18px;
        height: 18px;
    }

    .mini-day--side {
        width: 5px;
        height: 18px;
    }

    .mini-marker {
        width: 8px;
        height: 8px;
    }

    .mini-marker--empty {
        width: 6px;
        height: 6px;
    }

    .mini-marker--started {
        width: 8px;
        height: 8px;
    }

    .mini-marker--completed {
        width: 8px;
        height: 8px;
        font-size: 0.85rem;
    }

    .mini-marker--completed::before {
        transform: none;
    }
}

/* ========================================
   Bailouts Counter Styles
   ======================================== */

.bailouts-container {
    display: none;
    align-items: center;
    gap: 12px;
    font-family: var(--font-family);
    margin-top: 30px;
    align-self: flex-end;
    margin-right: -185px;
}

.year-section.active .bailouts-container {
    display: flex;
}

.bailouts-label {
    font-size: 1.25rem;
    font-weight: 400;
    letter-spacing: 2px;
    color: var(--color-text);
}

.bailouts-hearts {
    display: flex;
    align-items: center;
    gap: 4px;
}

.bailout-heart {
    width: 40px;
    height: 40px;
    object-fit: contain;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.bailout-heart--used {
    opacity: 0.2;
    filter: grayscale(100%);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .bailouts-container {
        margin-top: 20px;
        gap: 8px;
    }

    .bailouts-label {
        font-size: 1rem;
    }

    .bailout-heart {
        width: 22px;
        height: 22px;
    }
}

/* ========================================
   LOG Modal Styles
   ======================================== */

.log-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);
}

.log-modal-overlay.active {
    display: flex;
}

.log-modal {
    background-color: var(--color-bg);
    border: var(--border-width) solid var(--color-grid);
    padding: 50px 60px;
    max-width: 420px;
    width: 90%;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

.log-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--color-text);
    transition: opacity 0.2s ease;
    font-family: var(--font-family);
}

.log-modal-close:hover {
    opacity: 0.6;
}

.log-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.log-view--hidden {
    display: none;
}

.log-modal-title {
    font-family: var(--font-family);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 4px;
    margin-bottom: 10px;
}

.log-modal-subtitle {
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 1px;
    color: #666;
    margin-bottom: 35px;
}

.log-form-group {
    width: 100%;
    margin-bottom: 25px;
}

.log-input {
    width: 100%;
    padding: 16px 20px;
    font-family: var(--font-family);
    font-size: 1rem;
    letter-spacing: 2px;
    border: var(--border-width) solid var(--color-grid);
    background-color: transparent;
    outline: none;
    transition: border-color 0.2s ease;
    text-align: center;
}

.log-input:focus {
    border-color: var(--color-started);
}

.log-input::placeholder {
    color: #999;
    letter-spacing: 2px;
}

.log-input--code {
    font-size: 1.4rem;
    letter-spacing: 8px;
    text-transform: uppercase;
    font-weight: 700;
}

.log-btn {
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 3px;
    padding: 16px 40px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: var(--border-width) solid var(--color-grid);
    background-color: transparent;
    color: var(--color-text);
}

.log-btn-primary {
    background-color: var(--color-text);
    color: var(--color-bg);
}

.log-btn-primary:hover {
    background-color: transparent;
    color: var(--color-text);
}

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

.log-switch {
    margin-top: 30px;
    font-family: var(--font-family);
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: #666;
}

.log-switch a {
    color: var(--color-text);
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

.log-switch a:hover {
    opacity: 0.6;
}

.log-code-display {
    font-family: var(--font-family);
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 12px;
    padding: 25px 40px;
    border: var(--border-width) solid var(--color-started);
    color: var(--color-started);
    margin-bottom: 15px;
    user-select: all;
}

.log-code-hint {
    font-family: var(--font-family);
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: #999;
    margin-bottom: 30px;
}

.log-error {
    display: none;
    margin-top: 20px;
    padding: 12px 20px;
    background-color: rgba(196, 69, 54, 0.1);
    border: 1px solid var(--color-completed);
    color: var(--color-completed);
    font-family: var(--font-family);
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-align: center;
}

.log-error.active {
    display: block;
}

/* User Logout Cross */
.user-logout-container {
    position: relative;
    display: flex;
    align-items: center;
}

.logout-cross {
    position: absolute;
    right: 100%;
    top: 3px;
    margin-right: 10px;
    display: none;
    font-family: var(--font-family);
    font-size: 1.7rem;
    font-weight: 400;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-text);
    padding: 0;
    line-height: 1;
    transition: opacity 0.2s ease;
    opacity: 0;
}

.logout-cross.active {
    display: block;
    animation: crossSlideIn 0.2s ease forwards;
}

@keyframes crossSlideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

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

.logout-cross:hover {
    opacity: 0.6;
}

/* Menu button (edit goals) */
.menu-btn {
    position: absolute;
    right: 100%;
    top: 4px;
    margin-right: 35px;
    display: none;
    font-family: var(--font-family);
    font-size: 1.3rem;
    font-weight: 400;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-text);
    padding: 0;
    line-height: 1;
    transition: opacity 0.2s ease;
    opacity: 0;
    margin-top: 0;
}

.menu-btn.active {
    display: block;
    animation: menuSlideIn 0.2s ease forwards;
}

@keyframes menuSlideIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

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

.menu-btn:hover {
    opacity: 0.6;
}

/* User logged in state */
.btn-log.btn-log--user {
    font-weight: 700;
    color: var(--color-started);
}

/* LOG Modal Responsive */
@media (max-width: 500px) {
    .log-modal {
        padding: 40px 30px;
    }

    .log-modal-title {
        font-size: 1.2rem;
        letter-spacing: 3px;
    }

    .log-code-display {
        font-size: 1.8rem;
        letter-spacing: 8px;
        padding: 20px 25px;
    }

    .log-input--code {
        font-size: 1.2rem;
        letter-spacing: 6px;
    }

    .log-btn {
        padding: 14px 30px;
        font-size: 0.85rem;
    }
}

/* ========================================
   Set Goals View Styles
   ======================================== */

.log-goals-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.log-goal-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.log-goal-row .log-goal-input {
    flex: 1;
}

.log-goal-input {
    width: 100%;
    text-align: left;
    padding-left: 20px;
}

.log-goal-delete-btn {
    width: 52px;
    height: auto;
    padding: 16px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-family);
    font-size: 1.5rem;
    font-weight: 400;
    background: transparent;
    border: var(--border-width) solid var(--color-grid);
    cursor: pointer;
    color: var(--color-text);
    transition: all 0.2s ease;
    flex-shrink: 0;
    line-height: 1;
    box-sizing: border-box;
}

.log-goal-delete-btn:hover {
    background-color: var(--color-completed);
    border-color: var(--color-completed);
    color: var(--color-bg);
}

.log-goal-add-btn {
    width: 50px;
    height: 50px;
    font-family: var(--font-family);
    font-size: 2rem;
    font-weight: 400;
    background: transparent;
    border: var(--border-width) solid var(--color-grid);
    cursor: pointer;
    color: var(--color-text);
    transition: all 0.2s ease;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.log-goal-add-btn:hover {
    background-color: var(--color-text);
    color: var(--color-bg);
}

/* ========================================
   Today Checklist Styles
   ======================================== */

.today-section {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    padding: 0 20px;
    width: 200px;
    min-width: 200px;
    margin-top: 64px;
}

.today-section.active {
    display: flex;
}

.today-header {
    font-family: var(--font-family);
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 3px;
    margin-bottom: 20px;
    border-bottom: var(--border-width) solid var(--color-grid);
    padding-bottom: 10px;
    width: 100%;
}

.today-checklist {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.today-goal-item {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.today-goal-item:hover {
    opacity: 0.7;
}

.today-goal-checkbox {
    width: 22px;
    height: 22px;
    border: var(--border-width) solid var(--color-grid);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.today-goal-checkbox.checked {
    background-color: var(--color-started);
    border-color: var(--color-started);
}

.today-goal-checkbox.checked::after {
    content: '✓';
    color: var(--color-bg);
    font-size: 0.9rem;
    font-weight: 700;
}

.today-goal-text {
    font-family: var(--font-family);
    font-size: 0.95rem;
    letter-spacing: 1px;
    transition: text-decoration 0.2s ease;
}

.today-goal-item.completed .today-goal-text {
    text-decoration: line-through;
    opacity: 0.6;
}

.today-legend {
    display: flex;
    gap: 25px;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid rgba(26, 26, 26, 0.2);
}

.today-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-family);
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: #666;
}

.legend-circle {
    width: 14px;
    height: 14px;
    background-color: var(--color-started);
    border-radius: 50%;
}

.legend-star {
    font-size: 1.5rem;
    color: var(--color-completed);
    line-height: 1;
    margin-bottom: 5px;
}

/* Today Section Responsive */
@media (max-width: 600px) {
    .today-section {
        margin-top: 30px;
        padding: 0 10px;
    }

    .today-header {
        font-size: 1rem;
    }

    .today-goal-checkbox {
        width: 20px;
        height: 20px;
    }

    .today-goal-text {
        font-size: 0.85rem;
    }

    .today-legend {
        gap: 15px;
    }

    .today-legend-item {
        font-size: 0.7rem;
    }
}

/* ========================================
   Leaderboard Styles
   ======================================== */

.header-buttons-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0px;
    margin-right: -165px;
}

.btn-leaderboard {
    font-family: var(--font-family);
    font-size: 1.2rem;
    font-weight: 400;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-text);
    letter-spacing: 3px;
    transition: opacity 0.2s ease;
    text-transform: uppercase;
}

.btn-leaderboard:hover {
    opacity: 0.6;
}

.leaderboard-modal {
    max-width: 500px;
    padding: 50px 40px;
    min-height: 80vh;
    /* Make it tall like a page */
    display: flex;
    flex-direction: column;
}

.leaderboard-grid {
    width: 100%;
    margin-top: 20px;
    border-top: 1px solid var(--color-grid);
    border-bottom: 1px solid var(--color-grid);
}

.leaderboard-header {
    display: flex;
    border-bottom: 1px solid var(--color-grid);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.leaderboard-list {
    max-height: 60vh;
    overflow-y: auto;
}

/* Scrollbar styling */
.leaderboard-list::-webkit-scrollbar {
    width: 4px;
}

.leaderboard-list::-webkit-scrollbar-track {
    background: transparent;
}

.leaderboard-list::-webkit-scrollbar-thumb {
    background: var(--color-grid);
}

.leaderboard-row {
    display: flex;
    border-bottom: 1px solid rgba(26, 26, 26, 0.2);
    transition: background-color 0.1s ease;
}

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

.leaderboard-row:hover {
    background-color: var(--color-hover);
}

/* Columns */
.lb-col {
    padding: 15px 10px;
    display: flex;
    align-items: center;
}

.lb-rank {
    width: 60px;
    justify-content: center;
    border-right: 1px solid var(--color-grid);
}

.lb-name {
    flex: 1;
    padding-left: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lb-score {
    width: 80px;
    justify-content: center;
    border-left: 1px solid var(--color-grid);
    font-weight: 700;
}

.score-star {
    margin-left: 5px;
    color: var(--color-completed);
    font-size: 1.1rem;
}

/* User Highlighting */
.leaderboard-row.current-user {
    background-color: rgba(46, 139, 123, 0.1);
    /* Soft green tint */
}

/* Responsive Leaderboard */
@media (max-width: 768px) {
    .header-buttons-col {
        margin-right: 0;
    }
}

@media (max-width: 600px) {
    .btn-leaderboard {
        font-size: 0.75rem;
        letter-spacing: 2px;
    }

    .leaderboard-modal {
        padding: 40px 20px;
        width: 95%;
    }

    .lb-rank {
        width: 40px;
    }

    .lb-score {
        width: 60px;
    }

    .lb-col {
        padding: 12px 5px;
        font-size: 0.85rem;
    }
}