﻿/* ══════════════════════════════════════════════════════════════════
   CustomCalendar.css  —  Demo-style booking calendar
   Matches BookingCal v2.0 — colored avatars, clean grid, status badges
   ══════════════════════════════════════════════════════════════════ */

/* ── Design tokens ── */
:root {
    --cc-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --cc-bg: #ffffff;
    --cc-surface: #f8fafc;
    --cc-border: #e2e8f0;
    --cc-border-light: #f1f5f9;
    --cc-header-bg: #ffffff;
    --cc-header-border: #e2e8f0;
    --cc-gutter-bg: #f8fafc;
    --cc-time-color: #475569;
    --cc-time-ampm: #94a3b8;
    --cc-event-radius: 7px;
    --cc-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --cc-shadow-hover: 0 4px 14px rgba(0,0,0,.14);
    --cc-shadow-drag: 0 12px 30px rgba(0,0,0,.2);
    --cc-selection-color: #2563eb;
    --cc-selection-bg: rgba(37,99,235,.1);
    --cc-now-color: #dc2626;
    --cc-col-width: 140px;
    --cc-header-height: 80px;
    --cc-gutter-width: 62px;
    --cc-transition: 150ms ease;
}

/* ── Root ── */
.cc-root {
    font-family: var(--cc-font);
    font-size: 13px;
    line-height: 1.4;
    background: var(--cc-bg);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* ── Header strip (sticky top) ── */
.cc-header {
    display: flex;
    flex-shrink: 0;
    background: var(--cc-header-bg);
    border-bottom: 2px solid var(--cc-header-border);
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    position: sticky;
    top: 0;
    z-index: 20;
    overflow: hidden;
}

/* Corner (top-left, above time gutter) */
.cc-corner {
    width: var(--cc-gutter-width);
    flex-shrink: 0;
    background: var(--cc-gutter-bg);
    border-right: 1px solid var(--cc-border);
    z-index: 21;
}

.cc-header-outer {
    flex: 1;
    overflow: hidden;
}

.cc-header-cols {
    display: flex;
    will-change: transform;
}

/* Each employee column header */
.cc-col-header {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 4px 8px;
    position: relative;
    border-right: 1px solid var(--cc-border-light);
    background: var(--cc-header-bg);
    transition: background var(--cc-transition);
    cursor: default;
    box-sizing: border-box;
    overflow: visible;
}

    .cc-col-header:hover {
        background: #f8fafc;
    }

/* ── Scrollable body ── */
.cc-scroll {
    flex: 1;
    overflow: auto;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
    background: var(--cc-surface);
}

    .cc-scroll::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }

    .cc-scroll::-webkit-scrollbar-track {
        background: #f8fafc;
    }

    .cc-scroll::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 4px;
    }

        .cc-scroll::-webkit-scrollbar-thumb:hover {
            background: #94a3b8;
        }

.cc-inner {
    display: flex;
    position: relative;
}

/* ── Time gutter (sticky left) ── */
.cc-gutter {
    flex-shrink: 0;
    position: sticky;
    left: 0;
    z-index: 5;
    background: var(--cc-gutter-bg);
    border-right: 1px solid var(--cc-border);
    overflow: hidden;
}

.cc-time-label {
    position: absolute;
    right: 0;
    left: 0;
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    padding-right: 8px;
    transform: translateY(-50%);
    line-height: 1;
    pointer-events: none;
    gap: 1px;
}

.cc-time-hour {
    font-size: 12px;
    font-weight: 600;
    color: var(--cc-time-color);
}

.cc-time-ampm {
    font-size: 9px;
    font-weight: 500;
    color: var(--cc-time-ampm);
    text-transform: uppercase;
}

/* ── Grid canvas ── */
.cc-grid {
    position: relative;
    flex: 1;
}

.cc-bg, .cc-ev-layer {
    position: absolute;
    inset: 0;
}

.cc-ev-layer {
    pointer-events: none;
}

/* Grid cells */
.cc-col-strip {
    position: absolute;
    top: 0;
    bottom: 0;
    border-right: 1px solid var(--cc-border-light);
    box-sizing: border-box;
}

.cc-cell {
    position: absolute;
    left: 0;
    right: 0;
    box-sizing: border-box;
    transition: background var(--cc-transition);
}

    .cc-cell:hover {
        background: rgba(37,99,235,.03) !important;
    }

/* ── Now line ── */
.cc-now-line {
    position: absolute;
    left: 0;
    height: 2px;
    background: var(--cc-now-color);
    z-index: 8;
    pointer-events: none;
    display: none;
}

    .cc-now-line > div {
        position: absolute;
        left: -5px;
        top: -4px;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: var(--cc-now-color);
        box-shadow: 0 0 0 3px rgba(220,38,38,.2);
    }

/* ── Selection box ── */
.cc-selection {
    position: absolute;
    background: var(--cc-selection-bg);
    border: 2px solid var(--cc-selection-color);
    border-radius: var(--cc-event-radius);
    z-index: 7;
    pointer-events: none;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--cc-selection-color);
}

/* ══ EVENT CARDS ══════════════════════════════════════════════════ */
.cc-event {
    position: absolute;
    border-radius: 0 var(--cc-event-radius) var(--cc-event-radius) 0;
    border-left-width: 4px;
    border-left-style: solid;
    box-shadow: var(--cc-shadow);
    box-sizing: border-box;
    cursor: pointer;
    overflow: hidden;
    pointer-events: auto;
    z-index: 5;
    transition: box-shadow var(--cc-transition), transform var(--cc-transition);
}

    .cc-event:hover {
        box-shadow: var(--cc-shadow-hover) !important;
        transform: translateY(-1px);
        z-index: 20 !important;
    }

        .cc-event:hover .cc-resize-handle {
            opacity: 1 !important;
        }

    /* Drag/resize states */
    .cc-event.cc-dragging {
        opacity: .8;
        z-index: 200 !important;
        cursor: grabbing !important;
        box-shadow: var(--cc-shadow-drag) !important;
        transform: scale(1.02);
        transition: none;
    }

    .cc-event.cc-resizing {
        z-index: 200 !important;
        transition: none;
    }

/* Status variants */
.cc-event-completed {
    opacity: .5;
    filter: grayscale(.4);
}

    .cc-event-completed:hover {
        transform: none;
        cursor: default;
    }

/* In-service green pulse */
@keyframes cc-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(22,163,74,.4), var(--cc-shadow);
    }

    50% {
        box-shadow: 0 0 0 5px rgba(22,163,74,0), var(--cc-shadow);
    }
}

.cc-event-inservice {
    animation: cc-pulse 2.5s ease-in-out infinite;
}

/* ── Status badges inside events ── */
.cc-ev-badge {
    display: inline-flex;
    align-items: center;
    font-size: 9.5px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
    margin-top: 2px;
    width: fit-content;
    flex-shrink: 0;
    letter-spacing: .01em;
}

.cc-badge-waiting {
    background: rgba(124,58,237,.12);
    color: #6d28d9;
}

.cc-badge-inservice {
    background: rgba(22,163,74,.12);
    color: #15803d;
}

.cc-badge-done {
    background: rgba(100,116,139,.12);
    color: #475569;
}

/* ── Resize handle ── */
.cc-resize-handle {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8px;
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--cc-transition);
    touch-action: none;
}

/* ── Drag / resize cursor ── */
body.cc-dragging, body.cc-dragging * {
    cursor: grabbing !important;
}

body.cc-resizing, body.cc-resizing * {
    cursor: ns-resize !important;
}

/* ── Areas (icon overlays from callback) ── */
.cc-event-area {
    position: absolute;
    box-sizing: border-box;
}

/* ══ EMPLOYEE HEADER AVATAR (set by onBeforeHeaderRender) ═════════ */
.employee-header-avatar-container {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 0 4px;
    width: 100%;
}

    .employee-header-avatar-container:hover > div:first-child {
        transform: scale(1.06);
        transition: transform .15s;
    }

/* ══ MOBILE ════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    :root {
        --cc-col-width: 100px;
        --cc-header-height: 70px;
        --cc-gutter-width: 52px;
    }
}

@media (max-width: 480px) {
    :root {
        --cc-col-width: 85px;
        --cc-header-height: 65px;
        --cc-gutter-width: 44px;
    }
}
