/* === CSS/CALENDAR.CSS === */
/* Theme-compliant, zero-emoji, high-contrast calendar workspace for FocusedScribe */

#workspace-calendar {
    display: none;
    flex-direction: column;
    height: calc(100vh - 42px);
    height: calc(100dvh - 42px);
    background: var(--bg-color, #0f1117);
    color: var(--panel-text, #f0f6fc);
    font-family: inherit;
    overflow: hidden;
    position: relative;
    user-select: none;
}

/* === TOPBAR CONTROLS === */
.cal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 12px;
    background: var(--panel-bg, #161b22);
    border-bottom: 1px solid var(--grid-border-color, rgba(255, 255, 255, 0.12));
    z-index: 10;
    min-height: 42px;
}

.cal-topbar-left,
.cal-topbar-center,
.cal-topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cal-title-badge {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: var(--main-color, #58a6ff);
    display: flex;
    align-items: center;
    gap: 5px;
    text-transform: uppercase;
}

.cal-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--grid-border-color, rgba(255, 255, 255, 0.18));
    color: var(--panel-text, #f0f6fc);
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cal-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--main-color, #58a6ff);
    color: var(--main-color, #58a6ff);
}

.cal-btn.active {
    background: var(--main-color, #58a6ff);
    color: var(--bg-color, #0f1117);
    border-color: var(--main-color, #58a6ff);
}

.cal-month-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    min-width: 140px;
    text-align: center;
}

.cal-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0.85;
    padding: 2px 4px;
}

.cal-toggle-label:hover {
    opacity: 1;
}

.cal-toggle-label input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--main-color, #58a6ff);
}

/* === MAIN WORKSPACE CONTENT AREA === */
.cal-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

/* === MONTH GRID VIEW === */
.cal-month-grid {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 100%;
    width: 100%;
}

.cal-weekdays-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--panel-bg, #161b22);
    border-bottom: 1px solid var(--grid-border-color, rgba(255, 255, 255, 0.15));
    position: sticky;
    top: 0;
    z-index: 5;
}

.cal-weekday-col {
    padding: 6px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    text-align: center;
    opacity: 0.75;
    border-right: 1px solid var(--grid-border-color, rgba(255, 255, 255, 0.08));
}

.cal-weekday-col:last-child {
    border-right: none;
}

.cal-days-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(110px, 1fr);
    flex: 1;
    background: var(--bg-color, #0f1117);
}

.cal-day-cell {
    border-right: 1px solid var(--grid-border-color, rgba(255, 255, 255, 0.08));
    border-bottom: 1px solid var(--grid-border-color, rgba(255, 255, 255, 0.08));
    padding: 4px 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-height: 110px;
    position: relative;
    background: transparent;
    transition: background 0.12s ease;
}

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

.cal-day-cell.is-other-month {
    opacity: 0.35;
    background: rgba(0, 0, 0, 0.12);
}

.cal-day-cell.is-today {
    background: rgba(88, 166, 255, 0.04);
}

.cal-day-cell.is-today::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--main-color, #58a6ff);
}

.cal-day-cell.has-blackout {
    background: repeating-linear-gradient(
        -45deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 8px,
        rgba(255, 255, 255, 0.02) 8px,
        rgba(255, 255, 255, 0.02) 16px
    );
}

.cal-day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.cal-day-number {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    opacity: 0.85;
}

.cal-day-cell.is-today .cal-day-number {
    color: var(--main-color, #58a6ff);
    font-weight: 900;
}

.cal-blackout-badge {
    font-size: 8.5px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    opacity: 0.7;
    letter-spacing: 0.4px;
}

.cal-day-add-btn {
    opacity: 0;
    background: transparent;
    border: none;
    color: var(--main-color, #58a6ff);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    border-radius: 2px;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.cal-day-cell:hover .cal-day-add-btn {
    opacity: 0.7;
}

.cal-day-add-btn:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.1);
}

.cal-events-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    overflow-y: auto;
}

/* === EVENT CHIPS === */
.cal-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--grid-border-color, rgba(255, 255, 255, 0.15));
    color: var(--panel-text, #f0f6fc);
    transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.cal-chip:hover {
    transform: translateY(-1px);
    border-color: var(--main-color, #58a6ff);
    background: rgba(255, 255, 255, 0.12);
}

.cal-chip-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 3px;
    flex: 1;
}

.cal-chip.type-release {
    border-left: 3px solid var(--main-color, #58a6ff);
}

.cal-chip.type-draft {
    border-left: 3px solid #8b949e;
}

.cal-chip.type-milestone,
.cal-chip.type-deadline {
    border-left: 3px solid #f0883e;
}

.cal-chip.type-stack_due {
    border-left: 3px solid #a371f7;
}

/* Slipped Occurrence Pill */
.cal-chip.is-slipped {
    border-style: dashed;
    background: rgba(240, 136, 62, 0.08);
}

.cal-slip-badge {
    font-size: 8.5px;
    font-weight: 700;
    padding: 0 3px;
    border-radius: 2px;
    background: rgba(240, 136, 62, 0.2);
    color: #f0883e;
    margin-left: 2px;
}

/* Ghost / Blackout Muted Slot */
.cal-chip.is-ghost {
    opacity: 0.55;
    background: rgba(0, 0, 0, 0.25);
    border: 1px dashed var(--grid-border-color, rgba(255, 255, 255, 0.2));
}

.cal-chip.is-ghost:hover {
    opacity: 0.9;
}

.cal-ghost-actions {
    display: none;
    align-items: center;
    gap: 2px;
}

.cal-chip.is-ghost:hover .cal-ghost-actions {
    display: flex;
}

.cal-ghost-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: inherit;
    font-size: 8px;
    font-weight: 700;
    padding: 1px 3px;
    border-radius: 2px;
    cursor: pointer;
}

.cal-ghost-btn:hover {
    background: var(--main-color, #58a6ff);
    color: var(--bg-color, #0f1117);
}

/* Daily Stats Badge (Words & Sprints) */
.cal-stats-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.04);
    border-top: 1px solid var(--grid-border-color, rgba(255, 255, 255, 0.06));
    opacity: 0.8;
    margin-top: auto;
}

.cal-stats-badge span {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* === TIMELINE LIST VIEW === */
.cal-timeline-container {
    padding: 16px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cal-timeline-date-group {
    background: var(--panel-bg, #161b22);
    border: 1px solid var(--grid-border-color, rgba(255, 255, 255, 0.1));
    border-radius: 6px;
    padding: 8px 12px;
}

.cal-timeline-date-header {
    font-size: 11px;
    font-weight: 700;
    color: var(--main-color, #58a6ff);
    padding-bottom: 4px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--grid-border-color, rgba(255, 255, 255, 0.08));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cal-timeline-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* === HOVER TOOLTIP PILL === */
.cal-hover-pill {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    background: var(--panel-bg, #161b22);
    border: 1px solid var(--main-color, #58a6ff);
    color: var(--panel-text, #f0f6fc);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
    border-radius: 6px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 260px;
    font-size: 10.5px;
    transform: translate(-50%, -100%);
    margin-top: -10px;
}

.cal-hover-pill-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.cal-hover-pill-story {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(88, 166, 255, 0.15);
    color: var(--main-color, #58a6ff);
}

.cal-hover-pill-target {
    font-size: 10px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 4px;
}

.cal-hover-pill-status {
    font-size: 9.5px;
    opacity: 0.7;
    border-top: 1px dashed rgba(255, 255, 255, 0.15);
    padding-top: 3px;
    margin-top: 2px;
}

/* === MODAL DIALOGS === */
.cal-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
    z-index: 9500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.cal-modal-card {
    background: var(--panel-bg, #161b22);
    border: 1px solid var(--main-color, #58a6ff);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cal-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--grid-border-color, rgba(255, 255, 255, 0.12));
    font-size: 12px;
    font-weight: 700;
    color: var(--main-color, #58a6ff);
}

.cal-modal-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 11px;
}

.cal-field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cal-field-group label {
    font-size: 10px;
    font-weight: 700;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cal-input,
.cal-select {
    background: var(--bg-color, #0f1117);
    border: 1px solid var(--grid-border-color, rgba(255, 255, 255, 0.2));
    color: var(--panel-text, #f0f6fc);
    padding: 5px 8px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    outline: none;
}

.cal-input:focus,
.cal-select:focus {
    border-color: var(--main-color, #58a6ff);
}

.cal-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--grid-border-color, rgba(255, 255, 255, 0.12));
}

/* === MANUSCRIPT TODAY OBLIGATION BLOCK === */
#manuscript-today-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 12px;
    background: var(--panel-bg, #161b22);
    border-bottom: 1px solid var(--grid-border-color, rgba(255, 255, 255, 0.1));
    font-size: 10.5px;
    font-family: inherit;
    color: var(--panel-text, #f0f6fc);
    position: relative;
    z-index: 8;
    transition: opacity 0.2s ease, max-height 0.2s ease;
}

body.zen-mode #manuscript-today-bar {
    display: none !important;
}

.today-bar-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.today-badge-urgent {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(88, 166, 255, 0.15);
    color: var(--main-color, #58a6ff);
    border: 1px solid rgba(88, 166, 255, 0.3);
}

.today-link-btn {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    text-decoration: underline;
    font-weight: 600;
    padding: 0;
}

.today-link-btn:hover {
    color: var(--main-color, #58a6ff);
}
