/* ========================
   SIDEBAR WIDGET
   ======================== */

.sidebar-widget {
    margin-top: 16px;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 16px;
}

.widget-title {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ========================
   CALENDAR HEATMAP
   ======================== */

.ch-container {
    margin-bottom: 16px;
}

.ch-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.ch-year-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.ch-nav {
    display: flex;
    gap: 4px;
}

.ch-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 12px;
    color: #888;
    cursor: pointer;
}

.ch-btn:hover {
    background: #eee;
}

.ch-month-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ch-month-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ch-month-label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    width: 32px;
    flex-shrink: 0;
    text-align: right;
}

.ch-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 14px);
    gap: 2px;
}

.ch-cell {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    cursor: pointer;
    transition: transform 0.1s;
}

.ch-cell:hover {
    transform: scale(1.3);
}

.ch-cell.level-0 { background: #ebedf0; }
.ch-cell.level-1 { background: #9be9a7; }
.ch-cell.level-2 { background: #40c463; }
.ch-cell.level-3 { background: #30a14e; }
.ch-cell.level-4 { background: #216e39; }

.ch-tooltip {
    display: none;
    position: fixed;
    background: rgba(0,0,0,0.85);
    color: #fff;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    z-index: 9999;
    pointer-events: none;
    max-width: 200px;
}

.ch-tooltip-date {
    font-weight: 600;
    margin-bottom: 2px;
}

.ch-tooltip-count {
    color: #aaa;
    font-size: 11px;
}

/* ========================
   SIDEBAR CALENDAR
   ======================== */

.sidebar-calendar {
    margin-bottom: 0;
}

.scal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.scal-month {
    font-size: 13px;
    font-weight: 600;
    color: #444;
}

.scal-nav {
    display: flex;
    gap: 4px;
}

.scal-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 12px;
    color: #888;
    cursor: pointer;
}

.scal-btn:hover {
    background: #eee;
}

.scal-ybtn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 11px;
    color: #aaa;
    cursor: pointer;
}

.scal-ybtn:hover {
    background: #eee;
    color: #555;
}

.scal-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 2px;
}

.scal-wday {
    text-align: center;
    font-size: 10px;
    color: #aaa;
    padding: 2px 0;
}

.scal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
}

.scal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    cursor: default;
    position: relative;
    font-size: 11px;
    color: #888;
    min-height: 24px;
}

.scal-day.has-posts {
    cursor: pointer;
    background: #e8f5e9;
}

.scal-day.has-posts:hover {
    background: #c8e6c9;
}

.scal-day.today .scal-num {
    background: #3199db;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.scal-num {
    line-height: 1;
}

.scal-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #30a14e;
    position: absolute;
    bottom: 2px;
}

.scal-dim {
    min-height: 24px;
}

.scal-post-list {
    display: none;
    margin-top: 8px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 8px 10px;
}

.scal-post-title {
    font-size: 11px;
    color: #999;
    margin-bottom: 4px;
}

.scal-post-item {
    display: block;
    font-size: 12px;
    color: #3199db;
    text-decoration: none;
    padding: 2px 0;
}

.scal-post-item:hover {
    text-decoration: underline;
}

/* Night mode */
body.night-mode .sidebar-widget {
    background: #1e1e1e;
}

body.night-mode .widget-title,
body.night-mode .ch-year-label,
body.night-mode .scal-month {
    color: #ccc;
}

body.night-mode .scal-btn,
body.night-mode .scal-ybtn,
body.night-mode .ch-btn {
    border-color: #444;
    color: #999;
}

body.night-mode .scal-day.has-posts {
    background: #1e3a2a;
}

body.night-mode .scal-day.has-posts:hover {
    background: #2a4a35;
}

body.night-mode .scal-post-list {
    background: #252525;
    border-color: #333;
}

/* Mobile */
@media (max-width: 695px) {
    .sidebar-widget {
        padding: 12px;
    }

    .scal-day {
        min-height: 20px;
        font-size: 10px;
    }

    .ch-month-grid {
        width: 110px;
    }
}
