/* calendar.css - Modern Tasarım */
:root {
    --calendar-theme: var(--app-icon-color, #3498db);
    --calendar-theme-bg: color-mix(in srgb, var(--calendar-theme) 10%, transparent);
    --calendar-theme-hover: color-mix(in srgb, var(--calendar-theme) 20%, transparent);
}

/* Layout for Calendar + Sidebar */
#calendarContainer {
    display: none;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    gap: 20px;
    height: calc(100vh - 120px);
    overflow: hidden;
    flex-direction: row;
}

/* Hide scrollbars for calendar page */
#calendarContainer::-webkit-scrollbar,
#calendarContainer *::-webkit-scrollbar {
    display: none;
}

#calendarContainer {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

#calendarContainer * {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

@media (max-width: 1100px) {
    #calendarContainer {
        flex-direction: column;
        overflow-y: auto;
        height: calc(100vh - 100px);
        padding: 10px;
        gap: 15px;
    }

    .calendar-content-main {
        flex: none;
        height: auto;
        min-height: 500px;
    }

    .calendar-sidebar-panel {
        width: 100% !important;
        height: 350px;
        flex-shrink: 0;
    }

    .calendar-wrapper {
        height: 500px;
    }
}

.calendar-content-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0; /* Prevents flex items from overflowing their container */
}

.calendar-sidebar-panel {
    width: 320px;
    flex-shrink: 0; /* Keeps sidebar at 320px on desktop */
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    overflow: hidden;
}

.sidebar-tabs {
    display: flex;
    background: var(--bg-primary);
    padding: 5px;
    gap: 5px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-tab-btn {
    flex: 1;
    padding: 10px 5px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
}

.sidebar-tab-btn:hover {
    background: var(--nav-item-hover);
    color: var(--text-primary);
}

.sidebar-tab-btn.active {
    background: var(--bg-secondary);
    color: var(--calendar-theme);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.sidebar-empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    font-style: italic;
}

.sidebar-panel-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.sidebar-note-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
}

.sidebar-note-item:active {
    cursor: grabbing;
}

.sidebar-note-item:hover {
    background: var(--calendar-theme-bg);
    border-color: var(--calendar-theme);
    transform: translateX(3px);
}

.note-item-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.note-item-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Day Header for Add Button */
.day-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.add-note-inline {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--calendar-theme);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
}

.day-cell:hover .add-note-inline {
    opacity: 1;
}

.add-note-inline:hover {
    background: var(--calendar-theme);
    color: white;
    border-color: var(--calendar-theme);
}
.calendar-wrapper { 
    background-image: radial-gradient(var(--border-color) 1px, transparent 1px); 
    background-size: 24px 24px;
    background-color: var(--bg-secondary); 
    border-radius: 16px; 
    box-shadow: 0 10px 40px rgba(0,0,0,0.06), inset 0 0 50px rgba(0,0,0,0.01); 
    overflow: hidden; 
    border: 1px solid var(--border-color); 
    display: flex;
    flex-direction: column;
    height: 100%;
}

.calendar-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 15px 30px; 
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    backdrop-filter: blur(5px);
    flex-shrink: 0;
}
.calendar-header h2 { margin: 0; font-size: 1.4rem; font-weight: 700; color: var(--text-primary); text-transform: capitalize; }
.calendar-nav-btn { background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 8px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 24px; transition: all 0.2s; color: var(--text-secondary); }
.calendar-nav-btn:hover { background: var(--nav-item-hover); border-color: var(--border-color); transform: translateY(-1px); }
.calendar-grid { 
    display: grid; 
    grid-template-columns: repeat(7, 1fr); 
    grid-auto-rows: 1fr;
    background: var(--bg-primary); 
    flex: 1;
    overflow: hidden;
}
.day-name { 
    padding: 10px; 
    text-align: center; 
    font-size: 0.8rem; 
    color: var(--text-secondary); 
    font-weight: 600; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    background: var(--bg-secondary); 
    border-bottom: 1px solid var(--border-color); 
    display: flex;
    align-items: center;
    justify-content: center;
}
.day-cell { 
    background: var(--bg-secondary); 
    padding: 8px; 
    cursor: pointer; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    display: flex; 
    flex-direction: column; 
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    min-height: 0; 
    position: relative; 
}
.day-cell.other-month {
    opacity: 0.3;
}

/* Heatmap intensities */
.day-cell.heat-1 { background: color-mix(in srgb, var(--calendar-theme) 5%, transparent); }
.day-cell.heat-2 { background: color-mix(in srgb, var(--calendar-theme) 10%, transparent); }
.day-cell.heat-3 { background: color-mix(in srgb, var(--calendar-theme) 15%, transparent); }
.day-cell.heat-4 { background: color-mix(in srgb, var(--calendar-theme) 20%, transparent); }

.day-cell:hover { 
    background: var(--nav-item-hover); 
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    transform: translateY(-2px);
    z-index: 2; 
    border-radius: 8px;
    border-color: var(--calendar-theme);
}

.day-cell.selected {
    box-shadow: inset 0 0 0 2px var(--calendar-theme);
    background: var(--calendar-theme-bg);
}

.day-cell.today { 
    background: var(--calendar-theme-bg); 
    box-shadow: inset 0 0 0 2px var(--calendar-theme);
    border-radius: 4px;
}

.day-cell.today:hover {
    background: var(--calendar-theme-hover);
}

.day-cell.today.selected {
    box-shadow: inset 0 0 0 3px var(--calendar-theme);
}

.day-cell.today .day-number { 
    background: var(--calendar-theme); 
    color: white; 
    width: 32px; 
    height: 32px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border-radius: 50%; 
    margin-top: -4px; 
    margin-left: -4px; 
    box-shadow: 0 4px 10px color-mix(in srgb, var(--calendar-theme) 30%, transparent);
}

.day-number { 
    font-size: 0.9rem; 
    font-weight: 600; 
    color: var(--text-primary); 
    margin-bottom: 5px;
}

.note-indicators { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 5px; 
    margin-top: auto; 
    padding: 4px 0;
}

.note-dot { 
    width: 12px; 
    height: 12px; 
    border-radius: 4px; 
    border: 2px solid white; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}

.more-indicator {
    font-size: 11px;
    color: var(--calendar-theme);
    font-weight: 700;
}

/* Quick Peek Popover */
.day-preview-tooltip { 
    position: absolute; 
    bottom: 90%; 
    left: 50%; 
    transform: translateX(-50%) translateY(10px); 
    background: white; 
    color: #616161; 
    padding: 15px; 
    border-radius: 14px; 
    font-size: 13px; 
    min-width: 200px;
    opacity: 0; 
    visibility: hidden; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    z-index: 100; 
    box-shadow: 0 15px 45px rgba(0,0,0,0.15); 
    pointer-events: none; 
    border: 1px solid #eee;
}

.day-preview-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

.day-cell:hover .day-preview-tooltip { 
    opacity: 1; 
    visibility: visible; 
    transform: translateX(-50%) translateY(0); 
}

.preview-item { 
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px; 
    font-weight: 500;
}

.preview-item:last-child { margin-bottom: 0; }

.preview-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.preview-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.day-cell.drag-over { background: var(--calendar-theme-bg); box-shadow: inset 0 0 0 3px var(--calendar-theme); }
.animate-fade-in { animation: fadeIn 0.5s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 768px) { .day-cell { min-height: 80px; } .day-preview-tooltip { display: none; } }
