/* ═══════════════════════════════════════════════════════════════
   CALENDAR COMMAND SYSTEM v1.0 — Premium Glassmorphism UI
   Blue/Indigo theme to match Calendar branding
   ═══════════════════════════════════════════════════════════════ */

/* ─── COMMAND MENU ─────────────────────────────────────────── */
.cal-menu-overlay {
    position: fixed; inset: 0; z-index: 250;
    background: rgba(0,0,0,0.3); backdrop-filter: blur(6px);
    opacity: 0; transition: opacity 0.25s ease; pointer-events: none;
}
.cal-menu-overlay.open { opacity: 1; pointer-events: auto; }

.cal-menu {
    position: fixed; bottom: 80px; left: 50%;
    transform: translateX(-50%) translateY(12px) scale(0.96);
    width: 420px; max-width: 92vw; max-height: 70vh;
    background: rgba(22,22,26,0.92); backdrop-filter: blur(60px) saturate(1.6);
    border: 1px solid rgba(255,255,255,0.08); border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.04), inset 0 1px 0 rgba(255,255,255,0.05);
    overflow: hidden; opacity: 0;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.cal-menu-overlay.open .cal-menu {
    opacity: 1; transform: translateX(-50%) translateY(0) scale(1);
}

.cal-menu-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px 12px; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.cal-menu-header-left { display: flex; align-items: center; gap: 10px; }
.cal-menu-logo {
    width: 32px; height: 32px; border-radius: 10px;
    background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(129,140,248,0.10));
    border: 1px solid rgba(99,102,241,0.2);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cal-menu-logo svg { width: 15px; height: 15px; color: #818cf8; }
.cal-menu-title { font-size: 0.88rem; font-weight: 650; color: #f0f0f3; letter-spacing: -0.2px; }
.cal-menu-close {
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px; color: rgba(161,161,170,0.5); cursor: pointer;
    transition: all 0.2s; flex-shrink: 0;
}
.cal-menu-close svg { width: 13px; height: 13px; }
.cal-menu-close:hover { background: rgba(255,255,255,0.08); color: #e4e4e7; }

.cal-menu-body {
    padding: 8px 10px 12px; overflow-y: auto; max-height: 55vh; scrollbar-width: none;
}
.cal-menu-body::-webkit-scrollbar { display: none; }

.cal-cat { padding: 6px 8px 4px; }
.cal-cat-label {
    font-size: 0.6rem; font-weight: 700; letter-spacing: 1px;
    color: rgba(161,161,170,0.35); text-transform: uppercase; padding: 4px 0 6px;
}

.cal-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 12px; cursor: pointer;
    transition: all 0.2s ease; border: 1px solid transparent;
}
.cal-item:hover { background: rgba(99,102,241,0.06); border-color: rgba(99,102,241,0.12); }
.cal-item:active { transform: scale(0.98); }

.cal-item-icon {
    width: 34px; height: 34px; min-width: 34px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
    transition: all 0.2s;
}
.cal-item:hover .cal-item-icon {
    background: rgba(99,102,241,0.10); border-color: rgba(99,102,241,0.18);
    box-shadow: 0 0 12px rgba(99,102,241,0.08);
}
.cal-item-icon svg { width: 15px; height: 15px; color: rgba(161,161,170,0.5); transition: color 0.2s; }
.cal-item:hover .cal-item-icon svg { color: #818cf8; }

.cal-item-text { flex: 1; min-width: 0; }
.cal-item-label { font-size: 0.8rem; font-weight: 550; color: #e4e4e7; }
.cal-item-desc { font-size: 0.66rem; color: rgba(161,161,170,0.4); margin-top: 1px; }
.cal-item-arrow { color: rgba(161,161,170,0.2); font-size: 0.7rem; transition: transform 0.2s; flex-shrink: 0; }
.cal-item:hover .cal-item-arrow { color: #818cf8; transform: translateX(3px); }

/* ─── INLINE RESULTS ───────────────────────────────────────── */
.cal-results {
    background: rgba(22,22,26,0.6); backdrop-filter: blur(40px);
    border: 1px solid rgba(255,255,255,0.06); border-radius: 16px;
    padding: 18px; margin: 8px 0; max-width: 620px;
    animation: calSlideUp 0.35s ease both;
}
@keyframes calSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.cal-results-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px; padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.cal-results-title {
    font-size: 0.82rem; font-weight: 650; color: #f0f0f3;
    display: flex; align-items: center; gap: 8px;
}
.cal-results-title svg { width: 16px; height: 16px; color: #818cf8; }
.cal-results-count { font-size: 0.68rem; color: rgba(161,161,170,0.4); font-weight: 500; }

/* ─── EVENT CARD ───────────────────────────────────────────── */
.cal-event {
    padding: 12px 14px; border-radius: 12px; margin-bottom: 6px;
    border: 1px solid rgba(255,255,255,0.04); cursor: pointer;
    transition: all 0.25s ease; background: rgba(255,255,255,0.02);
    display: flex; align-items: flex-start; gap: 12px;
}
.cal-event:hover { background: rgba(99,102,241,0.04); border-color: rgba(99,102,241,0.10); }
.cal-event:last-child { margin-bottom: 0; }

.cal-event-time {
    min-width: 52px; flex-shrink: 0; text-align: center;
    padding: 6px 0;
}
.cal-event-hour {
    font-size: 0.85rem; font-weight: 700; color: #818cf8;
    line-height: 1.1;
}
.cal-event-ampm {
    font-size: 0.55rem; font-weight: 600; color: rgba(129,140,248,0.5);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.cal-event-allday {
    font-size: 0.65rem; font-weight: 600; color: #a78bfa;
    background: rgba(167,139,250,0.08); padding: 2px 8px;
    border-radius: 6px;
}

.cal-event-info { flex: 1; min-width: 0; }
.cal-event-title {
    font-size: 0.78rem; font-weight: 600; color: #e4e4e7;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-event-meta {
    font-size: 0.65rem; color: rgba(161,161,170,0.4);
    display: flex; gap: 8px; margin-top: 2px; flex-wrap: wrap;
}
.cal-event-meta span { white-space: nowrap; }

.cal-event-dot {
    width: 4px; border-radius: 2px; min-height: 32px;
    flex-shrink: 0; margin-right: -4px;
}
.cal-dot-blue    { background: #818cf8; }
.cal-dot-green   { background: #34d399; }
.cal-dot-orange  { background: #fb923c; }
.cal-dot-red     { background: #f87171; }
.cal-dot-purple  { background: #a78bfa; }

/* ─── STAT GRID ────────────────────────────────────────────── */
.cal-stat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px; margin-bottom: 16px;
}
.cal-stat {
    padding: 14px 16px; border-radius: 12px;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05);
    transition: all 0.2s;
}
.cal-stat:hover { background: rgba(99,102,241,0.04); border-color: rgba(99,102,241,0.10); }
.cal-stat-num { font-size: 1.4rem; font-weight: 700; color: #f0f0f3; }
.cal-stat-label {
    font-size: 0.65rem; color: rgba(161,161,170,0.45); font-weight: 500;
    margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px;
}
.cal-stat-indigo .cal-stat-num { color: #818cf8; }
.cal-stat-green .cal-stat-num  { color: #34d399; }
.cal-stat-amber .cal-stat-num  { color: #fbbf24; }
.cal-stat-red .cal-stat-num    { color: #f87171; }
.cal-stat-purple .cal-stat-num { color: #a78bfa; }

/* ─── SECTION HEADERS ──────────────────────────────────────── */
.cal-section-header {
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.8px;
    color: rgba(161,161,170,0.35); text-transform: uppercase;
    margin: 14px 0 8px; padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.cal-section-header:first-child { border-top: none; padding-top: 0; margin-top: 0; }

/* ─── FREE SLOT CARD ───────────────────────────────────────── */
.cal-slot {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: 12px; margin-bottom: 6px;
    background: rgba(16,185,129,0.04); border: 1px solid rgba(16,185,129,0.08);
    cursor: pointer; transition: all 0.2s;
}
.cal-slot:hover { background: rgba(16,185,129,0.08); border-color: rgba(16,185,129,0.15); }
.cal-slot-time {
    font-size: 0.78rem; font-weight: 650; color: #34d399;
    min-width: 120px;
}
.cal-slot-duration {
    font-size: 0.65rem; color: rgba(161,161,170,0.4);
    background: rgba(255,255,255,0.04); padding: 2px 8px;
    border-radius: 6px;
}
.cal-slot-btn {
    margin-left: auto; padding: 5px 14px; border-radius: 8px;
    background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.2);
    color: #34d399; font-size: 0.7rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.cal-slot-btn:hover { background: rgba(16,185,129,0.2); }

/* ─── CONFIRM MODAL ────────────────────────────────────────── */
.cal-confirm-overlay {
    position: fixed; inset: 0; z-index: 260;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(14px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.35s ease; pointer-events: none;
}
.cal-confirm-overlay.open { opacity: 1; pointer-events: auto; }

.cal-confirm {
    width: 420px; max-width: 92vw;
    background: rgba(22,22,26,0.94); backdrop-filter: blur(60px) saturate(1.6);
    border: 1px solid rgba(255,255,255,0.08); border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.04);
    padding: 24px; transform: translateY(20px) scale(0.96);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.cal-confirm-overlay.open .cal-confirm { transform: translateY(0) scale(1); }

.cal-confirm-title {
    font-size: 0.92rem; font-weight: 650; color: #f0f0f3;
    margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}
.cal-confirm-field {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.cal-confirm-label { font-size: 0.68rem; color: rgba(161,161,170,0.4); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.cal-confirm-value { font-size: 0.78rem; color: #e4e4e7; font-weight: 500; text-align: right; max-width: 60%; }

.cal-confirm-btns {
    display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px;
}
.cal-btn-cancel {
    padding: 9px 18px; border-radius: 10px; font-size: 0.8rem; font-weight: 550;
    background: transparent; border: 1px solid rgba(255,255,255,0.08);
    color: #a1a1aa; cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.cal-btn-cancel:hover { background: rgba(255,255,255,0.04); }
.cal-btn-confirm {
    padding: 9px 22px; border-radius: 10px; font-size: 0.8rem; font-weight: 600;
    background: linear-gradient(135deg, #6366f1, #818cf8); border: none;
    color: #fff; cursor: pointer; font-family: inherit;
    box-shadow: 0 4px 18px rgba(99,102,241,0.25);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.cal-btn-confirm:hover { box-shadow: 0 6px 24px rgba(99,102,241,0.35); transform: translateY(-1px); }

/* ─── INSIGHT BAR ──────────────────────────────────────────── */
.cal-insight-bar {
    display: flex; height: 8px; border-radius: 4px; overflow: hidden;
    background: rgba(255,255,255,0.06); margin: 8px 0;
}
.cal-insight-bar div { height: 100%; transition: width 0.5s ease; }
.cal-bar-meeting { background: #818cf8; }
.cal-bar-free    { background: #34d399; }
.cal-bar-busy    { background: #f87171; }

/* ─── LOADING / EMPTY / TOAST ──────────────────────────────── */
.cal-loading {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; font-size: 0.78rem; color: rgba(161,161,170,0.5);
}
.cal-spin {
    width: 18px; height: 18px;
    border: 2px solid rgba(99,102,241,0.15); border-top-color: #818cf8;
    border-radius: 50%; animation: calSpin 0.7s linear infinite; flex-shrink: 0;
}
@keyframes calSpin { to { transform: rotate(360deg); } }

.cal-empty {
    text-align: center; padding: 24px 20px;
    color: rgba(161,161,170,0.4); font-size: 0.78rem;
}
.cal-empty-icon { font-size: 2rem; margin-bottom: 8px; }

.cal-toast {
    position: fixed; top: 20px; right: 20px; z-index: 600;
    padding: 12px 20px; border-radius: 12px;
    font-size: 0.82rem; font-weight: 550; color: #fff;
    font-family: 'Inter', system-ui, sans-serif;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    transform: translateY(-10px); opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none; max-width: 360px;
}
.cal-toast.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.cal-toast-success { background: #16a34a; }
.cal-toast-error   { background: #dc2626; }
.cal-toast-info    { background: #6366f1; }

/* ─── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 480px) {
    .cal-menu { width: 95vw; bottom: 70px; }
    .cal-confirm { width: 95vw; }
    .cal-stat-grid { grid-template-columns: 1fr 1fr; }
    .cal-results { padding: 14px; max-width: 100%; }
}
