/* =========================
   ROOT
========================= */

:root {
    --bg: #f6f7fb;
    --panel: #ffffff;
    --border: #dfe3ea;
    --soft-border: #eceff4;
    --text: #2c3440;
    --muted: #8d97a5;

    --weekend: #d85a5a;
    --today: #59c36a;

    --timeline-bg: #f0f2f7;
    --grid-line: rgba(120, 130, 150, 0.12);

    --work: #f7b7c3;
    --personal: #aeeef2;
    --event: #f7e7a8;
    --planned: #f0b5ff;

    --shadow:
        0 4px 18px rgba(0,0,0,0.06);

    --radius: 16px;

    --header-height: 118px;
    --footer-height: 46px;

    --date-width: 90px;
    --row-height: 42px;

    --transition:
        180ms ease;
}

/* =========================
   RESET
========================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;

    font-family:
        Inter,
        system-ui,
        sans-serif;

    background: var(--bg);
    color: var(--text);
}

/* =========================
   APP
========================= */

#app {
    width: 100%;
    height: 100%;

    display: flex;
    flex-direction: column;
}

/* =========================
   HEADER
========================= */

#top-header {
    position: sticky;
    top: 0;
    z-index: 100;

    background: rgba(246,247,251,0.92);

    backdrop-filter: blur(14px);

    padding:
        14px
        18px
        12px;

    border-bottom:
        1px solid
        var(--soft-border);
}

/* =========================
   VIEW SELECTOR
========================= */

#view-selector {
    width: fit-content;

    display: flex;
    gap: 6px;

    padding: 6px;

    border-radius: 999px;

    background: #eceff5;

    opacity: 0.5;
    pointer-events: none;

    margin-bottom: 14px;
}

.selector-btn {
    border: none;
    outline: none;

    padding:
        10px
        20px;

    border-radius: 999px;

    font-size: 14px;
    font-weight: 600;

    background: transparent;
    color: #7d8794;
}

.selector-btn.active {
    background: white;
    box-shadow:
        0 1px 3px rgba(0,0,0,0.05);
}

/* =========================
   NAVIGATION
========================= */

#month-nav-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

#today-btn {
    width: 48px;
    height: 48px;

    border-radius: 50%;
    border: none;

    background: white;

    box-shadow: var(--shadow);

    cursor: pointer;

    font-size: 20px;

    transition: var(--transition);
}

#today-btn:hover {
    transform: scale(1.05);
}

#month-nav {
    flex: 1;

    display: flex;
    align-items: center;
    justify-content: space-between;

    background: white;

    border-radius: 999px;

    padding:
        10px
        12px;

    box-shadow: var(--shadow);
}

.nav-arrow {
    width: 42px;
    height: 42px;

    border-radius: 50%;
    border: none;

    background: #f3f5f9;

    font-size: 24px;
    cursor: pointer;

    transition: var(--transition);
}

.nav-arrow:hover {
    background: #e8ecf4;
    transform: scale(1.04);
}

#month-display {
    font-size: 18px;
    font-weight: 700;

    color: var(--text);
}

/* =========================
   TIMELINE SCALE
========================= */

.timeline-scale {
    position: sticky;
    z-index: 90;

    display: flex;
    align-items: center;

    padding:
        0
        18px;

    background:
        rgba(246,247,251,0.94);

    backdrop-filter: blur(10px);
}

#timeline-header {
    top: var(--header-height);

    border-bottom:
        1px solid
        var(--soft-border);

    height: 34px;
}

#timeline-footer {
    bottom: 0;

    border-top:
        1px solid
        var(--soft-border);

    height: var(--footer-height);
}

.date-column {
    width: var(--date-width);
    flex-shrink: 0;
}

.timeline-hours {
    position: relative;

    flex: 1;

    display: flex;
    justify-content: space-between;

    padding-left: 2px;
}

.hour-marker {
    font-size: 11px;
    font-weight: 600;

    color: var(--muted);
}

/* =========================
   SCROLL AREA
========================= */

#schedule-scroll {
    flex: 1;

    overflow-y: auto;
    overflow-x: hidden;

    position: relative;
}

#schedule-container {
    padding:
        6px
        18px
        60px;
}

/* =========================
   ROWS
========================= */

.schedule-row {
    display: flex;
    align-items: center;

    height: var(--row-height);

    margin-bottom: 6px;
}

.schedule-row.faded {
    opacity: 0.45;
}

.schedule-row.today {
    position: relative;
}

.schedule-row.today::before {
    content: "";

    position: absolute;
    inset: -2px;

    border:
        2px solid
        var(--today);

    border-radius: 12px;

    pointer-events: none;
}

/* =========================
   DATE LABEL
========================= */

.date-label {
    width: var(--date-width);
    flex-shrink: 0;

    font-size: 14px;
    font-weight: 700;

    color: var(--text);
}

.date-label.weekend {
    color: var(--weekend);
}

/* =========================
   TIMELINE BAR
========================= */

.timeline-bar {
    position: relative;

    flex: 1;
    height: 100%;

    border-radius: 12px;

    background: var(--timeline-bg);

    overflow: hidden;
}

/* =========================
   GRID LINES
========================= */

.grid-line {
    position: absolute;
    top: 0;
    bottom: 0;

    width: 1px;

    background: var(--grid-line);
}

.grid-line:last-child {
    right: 0;
}

/* =========================
   EVENTS
========================= */

.event-block {
    position: absolute;
    top: 0;
    bottom: 0;

    border-radius: 10px;

    cursor: pointer;

    transition:
        transform 120ms ease,
        filter 120ms ease,
        opacity 120ms ease;
}

.event-block:hover,
.event-block.highlighted {
    filter: brightness(1.08);
    transform: scaleY(1.05);
    z-index: 10;
}

/* EVENT TYPES */

.event-work {
    background: var(--work);
}

.event-personal {
    background: var(--personal);
}

.event-event {
    background: var(--event);
}

.event-planned {
    background: var(--planned);
}

/* =========================
   CURRENT TIME LINE
========================= */

.current-time-line {
    position: absolute;
    top: 0;
    bottom: 0;

    width: 2px;

    border-left:
        2px dashed
        rgba(220, 70, 70, 0.9);

    z-index: 20;

    pointer-events: none;
}

/* =========================
   TOOLTIP
========================= */

#event-tooltip {
    position: fixed;

    top: 0;
    left: 0;

    z-index: 9999;

    pointer-events: none;

    opacity: 0;

    min-width: 180px;

    padding:
        12px
        14px;

    border-radius: 14px;

    background: rgba(255,255,255,0.96);

    backdrop-filter: blur(12px);

    box-shadow:
        0 10px 30px rgba(0,0,0,0.12);

    transition:
        opacity 100ms ease;
}

.tooltip-title {
    font-size: 14px;
    font-weight: 800;

    margin-bottom: 4px;
}

.tooltip-time,
.tooltip-location {
    font-size: 12px;
    color: var(--muted);
}

/* =========================
   SKELETON
========================= */

.skeleton-box,
.skeleton-bar {
    position: relative;
    overflow: hidden;

    background:
        linear-gradient(
            90deg,
            #eceff4 0%,
            #f6f8fb 50%,
            #eceff4 100%
        );

    background-size: 200% 100%;

    animation:
        skeleton-loading
        1.3s infinite linear;
}

.skeleton-box {
    width: 56px;
    height: 18px;

    border-radius: 8px;
}

.skeleton-bar {
    flex: 1;
    height: 100%;

    border-radius: 12px;
}

@keyframes skeleton-loading {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -200% 0;
    }
}

/* =========================
   ROTATE OVERLAY
========================= */

#rotate-overlay {
    position: fixed;
    inset: 0;

    z-index: 10000;

    display: none;
    align-items: center;
    justify-content: center;

    background:
        rgba(246,247,251,0.97);

    backdrop-filter: blur(10px);
}

.rotate-content {
    text-align: center;
}

.rotate-icon {
    font-size: 56px;

    margin-bottom: 16px;
}

.rotate-text {
    font-size: 18px;
    font-weight: 700;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 900px) {

    :root {
        --date-width: 72px;
        --row-height: 36px;
    }

    #month-display {
        font-size: 16px;
    }

    .hour-marker {
        font-size: 10px;
    }
}

@media (max-width: 720px) and (orientation: portrait) {

    #rotate-overlay {
        display: flex;
    }
}

/* =========================
   TRANSITIONS
========================= */

#schedule-container {
    transition:
        opacity 180ms ease,
        transform 220ms ease;
}

#schedule-container.slide-left {
    animation:
        slideLeft 220ms ease;
}

#schedule-container.slide-right {
    animation:
        slideRight 220ms ease;
}

#schedule-container.fade-in {
    animation:
        fadeIn 180ms ease;
}

@keyframes slideLeft {

    from {
        opacity: 0;
        transform: translateX(-26px);
    }

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

@keyframes slideRight {

    from {
        opacity: 0;
        transform: translateX(26px);
    }

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

@keyframes fadeIn {

    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* =========================
   ERROR STATE
========================= */

.error-state {
    padding: 40px;

    text-align: center;

    color: #cc6666;

    font-size: 16px;
    font-weight: 600;
}