
/* ==========================================================================
   REFINED SURGERIES PREMIUM DESIGN (Match Image Exactly)
   ========================================================================== */

:root {
    --surgery-bg: var(--background);
    --surgery-card-bg: var(--surface);
    --surgery-border: #64748b; /* Slate-500: Gris oscuro sólido para máxima visibilidad */
    --surgery-accent: var(--primary);
    --surgery-text-muted: #1e293b; /* Azul muy oscuro casi negro para los números */
}

[data-theme="dark"] {
    --surgery-border: rgba(255, 255, 255, 0.15);
    --surgery-text-muted: rgba(255, 255, 255, 0.8);
}

.surgeries-premium-wrapper.no-bars-view {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--surgery-bg);
    color: #fff;
    font-family: 'Inter', sans-serif;
    z-index: 9999;
    overflow: hidden;
}

/* Sidebar */
.surgery-sidebar {
    width: 70px;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    border-right: 1px solid var(--surgery-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    gap: 20px;
}

.sidebar-logo {
    margin-bottom: 20px;
    opacity: 0.8;
}

.sidebar-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: var(--surgery-text-muted);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.sidebar-icon:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-icon.active {
    color: var(--surgery-accent);
    background: rgba(59, 130, 246, 0.1);
}

.sidebar-icon.active::after {
    content: '';
    position: absolute;
    left: -2px;
    top: 15%;
    height: 70%;
    width: 4px;
    background: var(--surgery-accent);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--surgery-accent);
}

.sidebar-spacer {
    flex: 1;
}

/* Main Content area */
.surgery-main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* Top Header */
.surgery-top-header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

.header-title-centered {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.header-profile-section {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
}

.profile-name-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.profile-name {
    font-size: 14px;
    font-weight: 600;
}

.profile-role {
    font-size: 11px;
    color: var(--surgery-text-muted);
}

.profile-avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

/* Calendar Container */
.surgery-calendar-viewport {
    flex: 1;
    padding: 10px 25px 25px 25px;
    overflow-y: auto;
}

.calendar-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 10px;
}

.nav-group-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-pills-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    display: flex;
    align-items: center;
    padding: 4px;
    border: 1px solid var(--surgery-border);
}

.nav-pill-btn {
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-pill-btn.active {
    background: rgba(255, 255, 255, 0.05);
}

.nav-arrow-btn {
    padding: 6px;
    color: var(--surgery-text-muted);
    cursor: pointer;
}

.nav-group-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-today {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--surgery-border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--surgery-text-muted);
}

.dropdown-month {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--surgery-border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
}

/* Calendar Grid */
.calendar-glass-grid {
    border: 1px solid var(--surgery-border);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}

.grid-header-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--surgery-border);
}

.header-day-label {
    padding: 15px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: var(--surgery-text-muted);
}

.grid-body-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-cell-premium {
    min-height: 120px;
    border-right: 1px solid var(--surgery-border);
    border-bottom: 1px solid var(--surgery-border);
    padding: 10px;
    position: relative;
}

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

.cell-day-number {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 16px;
    font-weight: 800;
    color: var(--surgery-text-muted);
    z-index: 5;
}

.calendar-cell-premium.today-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid var(--surgery-accent);
    box-shadow: inset 0 0 15px rgba(59, 130, 246, 0.2), 0 0 15px rgba(59, 130, 246, 0.2);
    z-index: 1;
    pointer-events: none;
}

.cell-surgeries-stack {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    z-index: 2;
}

/* Surgery Event Card */
.event-pill-card {
    background: var(--border-soft);
    border-radius: 10px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.event-pill-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.event-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.status-dot.green { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.status-dot.red { background: #ef4444; box-shadow: 0 0 8px #ef4444; }
.status-dot.purple { background: #a855f7; box-shadow: 0 0 8px #a855f7; }

.event-time {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
}

.event-doctor {
    font-size: 12px;
    font-weight: 700;
}

.event-type-label {
    font-size: 10px;
    color: var(--surgery-text-muted);
    margin-left: 14px;
}

/* Floating Action Button */
.fab-new-surgery {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background: var(--surgery-accent);
    color: #fff;
    padding: 12px 24px;
    border-radius: 99px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    transition: transform 0.2s;
    z-index: 100;
}

.fab-new-surgery:hover {
    transform: translateY(-4px);
    background: #2563eb;
}

/* Modal Enhancements */
.modal-overlay {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
}

.surgery-modal-glass {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

/* Utilities */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-cell-premium:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* Ensure grid body fills space */
.grid-body-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    min-height: 600px;
}

/* ==========================================================================
   MOBILE RESPONSIVE — Surgery Calendar
   ========================================================================== */
@media (max-width: 768px) {

    /* Wrapper padding */
    .surgeries-premium-content {
        padding: 14px !important;
        border-radius: 20px !important;
        min-height: unset !important;
    }

    /* ---- Nav Header: stack title above pills ---- */
    .calendar-nav-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 0 2px;
        margin-bottom: 14px;
    }

    .nav-group-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        width: 100%;
    }

    .nav-group-left h3 {
        font-size: 16px !important;
    }

    .nav-pills-container {
        width: 100%;
        justify-content: space-between;
        margin-left: 0 !important;
    }

    .nav-group-right {
        width: 100%;
        justify-content: flex-end;
    }

    .btn-today {
        font-size: 12px;
        padding: 6px 14px;
    }

    /* ---- Day label header ---- */
    .header-day-label {
        padding: 8px 2px;
        font-size: 10px;
        font-weight: 700;
        text-align: center;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    /* ---- Calendar cells: compact dot-only mode ---- */
    .calendar-cell-premium {
        min-height: 52px !important;
        padding: 4px 2px !important;
        cursor: pointer;
    }

    .cell-day-number {
        position: static !important;
        display: block;
        text-align: center;
        font-size: 12px !important;
        font-weight: 700 !important;
        line-height: 1.4;
    }

    /* Stack surgeries as tiny dots instead of full cards */
    .cell-surgeries-stack {
        margin-top: 4px !important;
        gap: 3px !important;
        align-items: center;
    }

    /* Hide the full event pill card on mobile — show dots instead */
    .event-pill-card {
        display: none !important;
    }

    /* Surgery dots rendered by JS via .mobile-dot class */
    .mobile-surgery-dots {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 3px;
        margin-top: 2px;
    }

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

    .mobile-dot.mine  { background: #22c55e; box-shadow: 0 0 5px #22c55e88; }
    .mobile-dot.other { background: #a855f7; box-shadow: 0 0 5px #a855f788; }

    /* Grid min-height reset for mobile */
    .grid-body-days {
        min-height: unset !important;
    }

    /* ---- Agenda list below calendar (mobile only) ---- */
    .mobile-agenda-section {
        margin-top: 20px;
    }

    .mobile-agenda-title {
        font-size: 11px;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.15em;
        color: var(--text-muted);
        margin-bottom: 10px;
        padding: 0 2px;
    }

    .mobile-agenda-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        border-radius: 14px;
        margin-bottom: 8px;
        background: var(--surface);
        border: 1px solid var(--border);
        cursor: pointer;
        transition: background 0.15s;
    }

    .mobile-agenda-item:active {
        background: var(--border-soft);
    }

    .mobile-agenda-dot-col {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        flex-shrink: 0;
        width: 10px;
    }

    .mobile-agenda-date-col {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 38px;
        flex-shrink: 0;
        background: var(--background);
        border-radius: 10px;
        padding: 6px 4px;
        border: 1px solid var(--border);
    }

    .mobile-agenda-day-num {
        font-size: 18px;
        font-weight: 900;
        line-height: 1;
        color: var(--text-main);
    }

    .mobile-agenda-day-name {
        font-size: 9px;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--text-muted);
        letter-spacing: 0.05em;
    }

    .mobile-agenda-info {
        flex: 1;
        min-width: 0;
    }

    .mobile-agenda-patient {
        font-size: 13px;
        font-weight: 700;
        color: var(--text-main);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-agenda-meta {
        font-size: 10px;
        color: var(--text-muted);
        margin-top: 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-agenda-time {
        font-size: 11px;
        font-weight: 700;
        color: var(--text-muted);
        flex-shrink: 0;
    }

    .mobile-agenda-empty {
        text-align: center;
        padding: 24px 0;
        opacity: 0.4;
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        color: var(--text-muted);
    }

    /* ---- FAB: fixed to viewport, above bottom nav ---- */
    .fab-new-surgery {
        position: fixed !important;
        bottom: 80px !important;
        right: 18px !important;
        padding: 10px 20px !important;
        font-size: 13px !important;
        box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45) !important;
        z-index: 9000 !important;
    }
}

