/* Calendar Module */

/* ---- Header with nav buttons ---- */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-3) 0;
    margin-bottom: var(--sp-2);
}

.calendar-header button {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    transition: all var(--dur-fast);
}

.calendar-header button:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-muted);
}

.calendar-header span {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
}

/* ---- Legend ---- */
.calendar-legend {
    display: flex;
    gap: var(--sp-4);
    margin-bottom: var(--sp-3);
    padding: 0 var(--sp-1);
}
.legend-item {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    font-size: var(--text-xs);
    color: var(--text-muted);
}
.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}
.legend-dot.event-dot { background: var(--accent); opacity: 0.7; }
.legend-dot.todo-dot { background: #FFB347; opacity: 0.7; }
.legend-dot.note-dot { background: #a78bfa; opacity: 0.7; }

/* ---- Calendar Grid ---- */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-card);
}

.cal-header-cell {
    padding: var(--sp-2);
    text-align: center;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}

.cal-cell {
    min-height: 90px;
    padding: var(--sp-2);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--dur-fast);
    position: relative;
}

.cal-cell:nth-child(7n+7) {
    border-right: none;
}

.cal-cell:hover {
    background: rgba(255,255,255,0.03);
}

.cal-cell.empty {
    cursor: default;
    background: rgba(0,0,0,0.15);
}

.cal-cell.today {
    background: var(--accent-muted);
}

.cal-day-num {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: var(--sp-1);
}

.cal-cell.today .cal-day-num {
    color: var(--accent);
}

.today-badge {
    background: var(--accent);
    color: white !important;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
}

.cal-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cal-event-chip {
    font-size: var(--text-xs);
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--accent-muted);
    color: var(--accent);
    cursor: pointer;
    transition: background var(--dur-fast);
}

.cal-event-chip:hover {
    background: rgba(108, 156, 255, 0.25);
}

/* Todo chips in calendar */
.cal-todo-chip {
    background: rgba(255, 179, 71, 0.15);
    color: #FFB347;
}
.cal-todo-chip:hover {
    background: rgba(255, 179, 71, 0.25);
}
/* Note chips in calendar */
.cal-note-chip {
    border: 1px solid transparent;
    color: var(--text-primary);
    font-style: italic;
}
.cal-note-chip:hover { opacity: 0.85; }

.note-item-cal {
    font-style: italic;
    font-size: var(--text-sm);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-md);
    display: flex; align-items: center; gap: var(--sp-2);
    margin-bottom: var(--sp-1);
}

.cal-todo-chip.todo-done {
    opacity: 0.5;
    text-decoration: line-through;
}

.cal-more {
    font-size: var(--text-xs);
    color: var(--text-muted);
    cursor: pointer;
    margin-top: 2px;
}

.cal-more:hover {
    color: var(--accent);
}

/* ---- Day Modal ---- */
.event-list-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    margin-bottom: var(--sp-2);
    border: 1px solid var(--border);
}

.event-list-item strong {
    color: var(--text-primary);
    font-size: var(--text-sm);
    flex: 1;
}

.event-list-item span {
    color: var(--text-muted);
    font-size: var(--text-xs);
}

.event-list-item .btn-icon.delete,
.event-list-item .btn-icon {
    background: none;
    border: none;
    color: var(--red);
    font-size: var(--text-xs);
    cursor: pointer;
    padding: var(--sp-1) var(--sp-2);
    border-radius: var(--radius-sm);
    transition: background var(--dur-fast);
}

.event-list-item .btn-icon:hover {
    background: var(--red-muted);
}

/* Inline dots */
.event-dot-inline {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}
.todo-dot-inline {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Todo in modal */
.todo-item-cal {
    gap: var(--sp-2);
}
.todo-item-cal.done { opacity: 0.5; }
.todo-check-cal {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex: 1;
    cursor: pointer;
}
.todo-check-cal input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.line-through { text-decoration: line-through; }
.todo-time-cal {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}
.todo-assignee-cal {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .cal-cell {
        min-height: 50px;
        padding: 4px;
    }
    .cal-event-chip {
        display: none;
    }
    .cal-day-num {
        font-size: var(--text-xs);
    }
    .calendar-header button {
        font-size: var(--text-xs);
        padding: var(--sp-1) var(--sp-2);
    }
}

/* ---- Floating Action Button (FAB) ---- */
.c-fab {
    position: fixed;
    bottom: calc(var(--sp-6) + 60px); /* Positioned above bottom navigation */
    right: var(--sp-6);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99;
    transition: all 0.2s var(--ease-out);
}
.c-fab:hover {
    transform: scale(1.08);
    background: var(--accent-hover);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}
.c-fab:active {
    transform: scale(0.95);
}
.color-picker {
    padding: 0;
    height: 40px;
    cursor: pointer;
    border: none;
    background: none;
}

