/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
    --shadow-lg: 0 8px 30px rgba(0,0,0,.15);

    --bg: #e8eaf0;
    --card: #ffffff;
    --sidebar-bg: #1e2233;
    --sidebar-text: #8b90a5;
    --sidebar-active: #ffffff;
    --topbar-bg: #ffffff;

    --border: #e0e3ea;
    --border-light: #f0f1f4;
    --text: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #adb3c0;

    --primary: #5b6abf;
    --primary-hover: #4a58a8;
    --primary-light: #eef0f7;
    --danger: #e05555;
    --danger-hover: #c94444;

    --type-team: #5b6abf;
    --type-client: #e8943a;
    --type-one_on_one: #43a047;
    --type-hr_interview: #c2628b;

    --sidebar-w: 60px;
    --topbar-h: 56px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    height: 100vh;
    overflow: hidden;
}

/* ===== Layout: sidebar + main ===== */
.layout {
    display: flex;
    height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    flex-shrink: 0;
    z-index: 30;
}

.sidebar-logo {
    margin-bottom: 16px;
}

.sidebar-logo-img {
    width: calc(var(--sidebar-w) - 8px);
    height: auto;
    object-fit: contain;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.sidebar-link {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all .15s;
}

.sidebar-link:hover { background: rgba(255,255,255,.08); color: #bfc3d6; }
.sidebar-link.active { background: rgba(255,255,255,.12); color: var(--sidebar-active); }

.sidebar-bottom {
    margin-top: auto;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    cursor: default;
}

.sidebar-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,.15);
}

/* ===== Main ===== */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ===== Top bar ===== */
.topbar {
    height: var(--topbar-h);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 20px;
    flex-shrink: 0;
    z-index: 20;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-left h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.topbar-center {
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-right {
    margin-left: auto;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    transition: all .15s;
}
.nav-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.nav-btn-today { font-weight: 600; }

.week-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    min-width: 200px;
    text-align: center;
}

.legend { display: flex; gap: 14px; flex-wrap: wrap; }

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

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

/* ===== Type colors ===== */
.type-team { background: var(--type-team); }
.type-client { background: var(--type-client); }
.type-one_on_one { background: var(--type-one_on_one); }
.type-hr_interview { background: var(--type-hr_interview); }

/* ===== Calendar area ===== */
.calendar-area {
    flex: 1;
    padding: 20px;
    overflow: hidden;
    display: flex;
}

.calendar-card {
    flex: 1;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.calendar {
    display: grid;
    grid-template-columns: 52px repeat(5, 1fr);
    grid-template-rows: 48px repeat(22, minmax(30px, 1fr));
    flex: 1;
    overflow-y: auto;
}

/* Corner */
.cal-corner {
    background: var(--card);
    border-bottom: 2px solid var(--border);
    border-right: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Day headers */
.cal-header {
    background: var(--card);
    border-bottom: 2px solid var(--border);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.cal-header-day {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.cal-header-date {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.cal-header.today .cal-header-day { color: var(--primary); }
.today-badge { background: var(--primary); color: #fff !important; }

/* Time labels */
.time-label {
    grid-column: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 2px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    border-right: 1px solid var(--border-light);
}

/* Cells */
.cal-cell {
    border-bottom: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    position: relative;
    cursor: pointer;
    transition: background .1s;
}

.cal-cell.hour-start { border-top: 1px solid var(--border); }
.cal-cell:hover { background: rgba(91,106,191,.06); }
.cal-cell.past { background: #f8f9fb; cursor: default; }
.cal-cell.past:hover { background: #f8f9fb; }

.cell-time {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 10px;
    color: var(--text-secondary);
    opacity: .55;
    pointer-events: none;
    user-select: none;
}

/* ===== Booking blocks ===== */
.booking-block {
    border-radius: 6px;
    padding: 4px 8px;
    margin: 1px 3px;
    font-size: 11px;
    color: #fff;
    overflow: hidden;
    cursor: pointer;
    z-index: 5;
    line-height: 1.3;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
    transition: transform .15s, box-shadow .15s;
}

.booking-block:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,.16);
}

.bb-time { font-weight: 600; font-size: 11px; opacity: .95; }
.bb-title { font-size: 11px; font-weight: 500; margin-top: 1px; }
.bb-author { font-size: 10px; opacity: .75; margin-top: 1px; }

/* ===== Time line ===== */
.time-now-line-container { position: relative; pointer-events: none; z-index: 6; }
.time-now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); }
.time-now-dot {
    position: absolute;
    left: -4px; top: -3px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.3);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
}

.modal {
    background: var(--card);
    border-radius: 16px;
    padding: 28px;
    width: 420px;
    max-width: 100%;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-header h2 { font-size: 18px; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all .15s;
    flex-shrink: 0;
}
.modal-close:hover { background: #f0f0f0; color: var(--text); }

.form-row { margin-bottom: 14px; }
.form-row label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.form-row input,
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: #fafbfc;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91,106,191,.12);
    background: #fff;
}

.form-row textarea { resize: vertical; }
.form-row-time { display: flex; gap: 12px; }
.form-row-time > div { flex: 1; }

.form-actions { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-secondary { background: #f0f2f5; color: var(--text-secondary); }
.btn-secondary:hover { background: #e4e7ec; }

.modal-error {
    background: #fef2f2;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-top: 8px;
    border: 1px solid #fecaca;
}

.booking-info { display: flex; flex-direction: column; gap: 12px; }
.info-row { display: flex; gap: 12px; font-size: 14px; }
.info-label { color: var(--text-secondary); min-width: 80px; font-weight: 500; }

/* ===== Recurring booking marker ===== */
.booking-block.is-recurring {
    opacity: .8;
    border: 1.5px dashed rgba(255,255,255,.5);
}

.bb-recurring-icon {
    font-size: 12px;
    margin-right: 2px;
    vertical-align: middle;
}

/* ===== Recurring panel (right sidebar) ===== */
.recurring-panel {
    width: 320px;
    background: var(--card);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.rp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.rp-header h2 { font-size: 16px; font-weight: 600; }

.rp-form {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.rp-form .form-row { margin-bottom: 10px; }
.rp-form .form-row label { font-size: 11px; }
.rp-form .form-row input,
.rp-form .form-row select {
    padding: 8px 10px;
    font-size: 13px;
}

.rp-list {
    flex: 1;
    padding: 12px 20px;
    overflow-y: auto;
}

.rp-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 24px 0;
}

.rp-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.rp-item:last-child { border-bottom: none; }

.rp-item-color {
    width: 4px;
    min-height: 36px;
    border-radius: 2px;
    flex-shrink: 0;
    margin-top: 2px;
}

.rp-item-info { flex: 1; min-width: 0; }
.rp-item-day { font-size: 13px; font-weight: 600; color: var(--text); }
.rp-item-time { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.rp-item-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.rp-item-delete {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    transition: color .15s;
    flex-shrink: 0;
}
.rp-item-delete:hover { color: var(--danger); }

/* ===== Transitions ===== */
.modal-enter-active { transition: opacity .2s ease; }
.modal-leave-active { transition: opacity .15s ease; }
.modal-enter-from, .modal-leave-to { opacity: 0; }
.modal-enter-active .modal { transition: transform .2s ease, opacity .2s ease; }
.modal-leave-active .modal { transition: transform .15s ease, opacity .15s ease; }
.modal-enter-from .modal { transform: scale(.95) translateY(8px); opacity: 0; }
.modal-leave-to .modal { transform: scale(.95) translateY(8px); opacity: 0; }
.fade-enter-active, .fade-leave-active { transition: opacity .2s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

.panel-enter-active { transition: transform .2s ease, opacity .2s ease; }
.panel-leave-active { transition: transform .15s ease, opacity .15s ease; }
.panel-enter-from { transform: translateX(100%); opacity: 0; }
.panel-leave-to { transform: translateX(100%); opacity: 0; }

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 900px) {
    .topbar-left h1 { font-size: 16px; }
    .week-label { font-size: 13px; }
    .legend { gap: 8px; }
    .legend-item { font-size: 11px; }
    .calendar-area { padding: 12px; }
}

@media (max-width: 700px) {
    .sidebar { display: none; }
    .recurring-panel {
        position: fixed;
        right: 0; top: 0; bottom: 0;
        width: 300px;
        max-width: 85vw;
        z-index: 50;
        box-shadow: -4px 0 20px rgba(0,0,0,.15);
    }

    .topbar {
        flex-wrap: wrap;
        height: auto;
        padding: 10px 14px;
        gap: 8px;
    }

    .topbar-left { order: 1; }
    .topbar-center { order: 2; margin-left: 0; }
    .topbar-right { order: 3; width: 100%; margin-left: 0; }

    .week-label { font-size: 13px; }
    .nav-btn { padding: 5px 10px; font-size: 13px; }
    .legend { gap: 8px; }
    .legend-item { font-size: 10px; gap: 4px; }
    .legend-dot { width: 7px; height: 7px; }

    .calendar-area { padding: 8px; }
    .calendar-card { border-radius: 10px; }

    .calendar {
        grid-template-columns: 36px repeat(5, 1fr);
        grid-template-rows: 40px repeat(22, minmax(26px, 1fr));
    }

    .time-label { font-size: 9px; }
    .cal-header-day { font-size: 10px; letter-spacing: 0; }
    .cal-header-date { font-size: 13px; width: 24px; height: 24px; }
    .cell-time { font-size: 8px; }

    .booking-block { padding: 2px 4px; margin: 1px 1px; border-radius: 5px; }
    .bb-time { font-size: 10px; }
    .bb-title { font-size: 10px; }
    .bb-author { display: none; }

    .modal-overlay { padding: 8px; }
    .modal { border-radius: 12px; padding: 20px 16px; }
    .modal-header h2 { font-size: 16px; }
    .form-row input,
    .form-row select,
    .form-row textarea { padding: 10px; font-size: 16px; }
    .btn { padding: 10px 16px; font-size: 14px; flex: 1; text-align: center; }
    .info-row { flex-direction: column; gap: 2px; }
    .info-label { min-width: auto; }
}

@media (max-width: 380px) {
    .calendar {
        grid-template-columns: 28px repeat(5, 1fr);
        grid-template-rows: 36px repeat(22, minmax(22px, 1fr));
    }
    .time-label { font-size: 8px; }
    .cal-header-day { font-size: 9px; }
    .cal-header-date { font-size: 12px; width: 22px; height: 22px; }
    .cell-time { display: none; }
    .bb-time { font-size: 9px; }
    .bb-title { display: none; }
}

/* =============================================================
   THEME: PINK
   ============================================================= */

/* SVG bow pattern — inline, no extra files */
.theme-pink {
    --bg: #fdf2f8;
    --card: #ffffff;
    --sidebar-bg: #9d174d;
    --sidebar-text: #f9a8d4;
    --sidebar-active: #ffffff;
    --topbar-bg: #fff5f9;

    --border: #f3d1e0;
    --border-light: #fce7f0;
    --text: #4a1942;
    --text-secondary: #9b5078;
    --text-muted: #d4a0bc;

    --primary: #db2777;
    --primary-hover: #be185d;
    --primary-light: #fce7f3;
    --danger: #e11d48;
    --danger-hover: #be123c;

    --type-team: #e472a8;       /* тёплый розовый */
    --type-client: #c88bc4;     /* сиреневый */
    --type-one_on_one: #f4a5c0; /* нежно-розовый */
    --type-hr_interview: #b06ea5;/* пыльная роза */
}

/* Bow pattern on background */
.theme-pink .calendar-area {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='%23f9a8d4' fill-opacity='0.12'%3E%3Cpath d='M40 30 C32 24 20 22 20 30 C20 36 30 36 40 30Z'/%3E%3Cpath d='M40 30 C48 24 60 22 60 30 C60 36 50 36 40 30Z'/%3E%3Ccircle cx='40' cy='30' r='2.5'/%3E%3Cpath d='M37 32 Q40 44 40 48 Q40 44 43 32Z'/%3E%3C/g%3E%3C/svg%3E")
        repeat,
        var(--bg);
}

/* Sidebar — deeper pink with subtle bow pattern */
.theme-pink .sidebar {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Cpath d='M30 22 C24 17 15 16 15 22 C15 27 23 27 30 22Z'/%3E%3Cpath d='M30 22 C36 17 45 16 45 22 C45 27 37 27 30 22Z'/%3E%3Ccircle cx='30' cy='22' r='2'/%3E%3Cpath d='M28 24 Q30 33 30 36 Q30 33 32 24Z'/%3E%3C/g%3E%3C/svg%3E")
        repeat,
        var(--sidebar-bg);
}

/* Top bar subtle pink */
.theme-pink .topbar {
    border-bottom-color: var(--border);
}

/* Calendar card — soft border */
.theme-pink .calendar-card {
    border: 1px solid var(--border);
}

/* Header glow for today */
.theme-pink .cal-header.today .cal-header-day { color: var(--primary); }
.theme-pink .today-badge { background: var(--primary); }

/* Booking blocks — softer with translucent overlays */
.theme-pink .booking-block {
    box-shadow: 0 1px 6px rgba(219,39,119,.15);
}

/* Cells hover */
.theme-pink .cal-cell:hover { background: #fce7f3; }

/* User badge */
.theme-pink .user-badge {
    background: #fce7f3;
    color: var(--primary);
}

/* Sidebar avatar ring */
.theme-pink .sidebar-avatar {
    background: #f472b6;
}

.theme-pink .sidebar-avatar-img {
    border-color: rgba(244,114,182,.4);
}

/* Sidebar nav active */
.theme-pink .sidebar-link:hover { background: rgba(255,255,255,.1); color: #fce7f3; }
.theme-pink .sidebar-link.active { background: rgba(255,255,255,.15); }

/* Modal */
.theme-pink .modal {
    border: 1px solid var(--border);
}

.theme-pink .form-row input:focus,
.theme-pink .form-row select:focus,
.theme-pink .form-row textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(219,39,119,.12);
}

/* Buttons */
.theme-pink .btn-secondary {
    background: #fce7f3;
    color: var(--text-secondary);
}
.theme-pink .btn-secondary:hover { background: #fbcfe8; }

/* Recurring panel */
.theme-pink .recurring-panel {
    border-left-color: var(--border);
}

/* Time line */
.theme-pink .time-now-line { background: var(--primary); }
.theme-pink .time-now-dot { background: var(--primary); }

/* Nav buttons */
.theme-pink .nav-btn { border-color: var(--border); }
.theme-pink .nav-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* Week label */
.theme-pink .week-label { color: var(--text); }

/* Legend */
.theme-pink .legend-item { color: var(--text-secondary); }
