:root {
    color-scheme: dark;
    /* WAHA Dashboard Palette */
    --bg-body: #0b1120;
    /* Deepest Black/Blue */
    --bg-card: #151e32;
    /* Content Card */
    --bg-sidebar: #0f172a;
    /* Sidebar/Header */
    --text-primary: #e2e8f0;
    /* Bright White/Grey */
    --text-secondary: #94a3b8;
    /* Muted Blue/Grey */

    --accent-primary: #3b82f6;
    /* Secondary Blue */
    --accent-green: #10b981;
    /* WAHA Vibrant Green */
    --accent-red: #ef4444;
    /* Error Red */

    --border-color: #1e293b;
    /* Subtle Borders */
    --input-bg: #0f172a;
    /* Input Backgrounds */
    --hover-bg: #1e293b;
    /* Hover States */
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* LOGIN */
#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-box {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 16px;
    width: 320px;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* LAYOUT */
#app-screen {
    display: flex;
    height: 100vh;
    width: 100%;
}

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    background: var(--bg-body);
    display: flex;
    flex-direction: column;
}

/* MODAL EMERGENTE */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    width: 450px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    position: relative;
}

textarea {
    width: 100%;
    height: 100px;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    resize: none;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text-primary);
}

textarea:focus {
    outline: none;
    border-color: var(--accent-green);
}


#notification-dropdown {
    background: rgba(101, 106, 118, 0.1) !important;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

/* VIEW NAVIGATION (Fix for all-in-one-page bug) */
.section-view {
    display: none;
}

.section-view.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* COMPONENTS */
.section-view {
    display: none;
    /* Hidden by default */
    padding: 20px 0;
}

.section-view.active {
    display: block;
    /* Show when active */
}

/* Center cards in simple views like Registro */
#view-registro.active {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 100px);
}

#view-registro>.card {
    max-width: 500px;
    width: 100%;
}

/* Other views - centered vertically and horizontally */
#view-agente.active,
#view-cola.active,
#view-usuarios.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 100px);
}

/* Config view needs flex-start due to multiple cards */
#view-config.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-bottom: 40px;
}

#view-cuidador.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Fix for top clipping */
    min-height: calc(100vh - 100px);
    gap: 20px;
    padding-top: 50px;
    padding-bottom: 200px;
}

/* Make cards wider in these views */
#view-agente>.card,
#view-cola>.card {
    max-width: 100%;
    width: 100%;
}

#view-cuidador>.card {
    max-width: 100%;
    width: 100%;
}

/* Config view cards - consistent width */
#view-config>.card {
    width: 100%;
    max-width: 800px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

/* HEADERS */
h2,
h3 {
    color: var(--text-primary);
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar h2 {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 20px;
    color: var(--accent-green);
}

/* INPUTS */
input,
select,
textarea {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    width: 100%;
    font-size: 0.95rem;
    margin: 8px 0;
    box-sizing: border-box;
    transition: all 0.2s;
    color-scheme: dark;
    /* Force native pickers to dark */
    accent-color: var(--accent-green);
    /* Try to force theme color */
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

::placeholder {
    color: #64748b;
    opacity: 1;
}

/* BUTTONS */
button {
    cursor: pointer;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    margin: 2px;
}

button:hover {
    filter: brightness(110%);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

.btn-full {
    width: 100%;
    padding: 14px;
    margin-top: 4px;
    background: var(--accent-green);
    color: #fff;
}

.btn-green {
    background: var(--accent-green);
    color: #fff;
}

.btn-blue {
    background: var(--accent-primary);
    color: #fff;
}

.btn-red {
    background: var(--accent-red);
    color: #fff;
}

.btn-grey {
    background: #334155;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

/* NAV BUTTONS */
.nav-btn {
    background: transparent;
    color: var(--text-secondary);
    width: 100%;
    justify-content: flex-start;
    padding: 12px 16px;
    font-weight: 500;
}

.nav-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.nav-btn.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* PESTAÑAS (TABS) TABLERO */
/* PESTAÑAS (TABS) TABLERO */
.tabs {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    overflow-x: auto;
    /* Allow horizontal scroll */
    white-space: nowrap;
    /* Prevent wrapping */
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
    padding-bottom: 5px;
    /* Space for scrollbar if any */
}

.tabs::-webkit-scrollbar {
    height: 4px;
}

.tabs::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.tab-btn {
    padding: 10px 4px;
    cursor: pointer;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    font-weight: 500;
    margin-bottom: -1px;
    transition: all 0.2s;
    white-space: nowrap;
    /* Keep text on one line */
    flex-shrink: 0;
    /* Don't shrink buttons */
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-green);
    background: transparent;
    border-bottom: 2px solid var(--accent-green);
}

/* TABLES */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 10px;
}

th {
    text-align: left;
    padding: 16px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.fila-verde {
    border-left: 3px solid var(--accent-green);
}

.fila-salmon {
    border-left: 3px solid orange;
}

.fila-rojo {
    border-left: 3px solid var(--accent-red);
}

/* UTILS */
.tag {
    background: #1e293b;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8em;
    color: var(--accent-green);
    border: 1px solid var(--border-color);
}

.user-info {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* INTL TEL INPUT OVERRIDES */
.iti {
    width: 100%;
    margin: 8px 0;
}

.iti__country-list {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    z-index: 3000;
}

.iti__country.iti__highlight {
    background-color: var(--hover-bg) !important;
}

.iti__dial-code {
    color: var(--text-secondary) !important;
}

.iti__country-name {
    color: var(--text-primary) !important;
}

/* TOAST */
/* TOAST CONTAINER */
#toast-container {
    position: fixed;
    bottom: 20px;
    /* Anchored to bottom */
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    /* Stack top-down (Oldest Top, Newest Bottom) */
    /* Since anchored to bottom, growing height pushes top items UP. */
    gap: 12px;
    max-width: 360px;
    width: 100%;
    pointer-events: none;
    /* Let clicks pass through gaps */
}

/* TOAST ITEM (Liquid Glass) */
.toast-item {
    pointer-events: auto;
    background: rgba(30, 41, 59, 0.7);
    /* Dark semi-transparent */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    color: #e2e8f0;
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateY(20px);
    /* Enter from below */
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    min-height: 60px;
    position: relative;
    overflow: hidden;
}

.toast-item.show {
    opacity: 1;
    transform: translateY(0);
}

/* GLOW EFFECT ON LEFT (Replacing solid bar) */
.toast-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: currentColor;
    /* Will inherit from specific type color */
}

.toast-item.info {
    color: #60a5fa;
}

/* Blue tint */
.toast-item.success {
    color: #4ade80;
}

/* Green tint */
.toast-item.warning {
    color: #fbbf24;
}

/* Amber tint */
.toast-item.error {
    color: #f87171;
}

/* Red tint */

/* ICON */
.toast-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 5px currentColor);
}

/* CONTENT */
.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    color: #f8fafc;
    /* White text for content */
}

.toast-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.toast-message {
    font-size: 0.8rem;
    color: #cbd5e1;
    line-height: 1.3;
}

/* CLOSE BUTTON */
.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    transition: color 0.2s;
}

.toast-close:hover {
    color: #fff;
}

.wa-notification-card {
    background: rgba(101, 106, 118, 0.1) !important;
    /* Very transparent */
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 5px solid #25D366;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    width: 300px;
    cursor: pointer;
    animation: slideIn 0.3s ease-out;
    z-index: 9999;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

/* CUSTOM CHECKBOX STYLE */
.role-checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.2s;
}

.role-checkbox-label:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-secondary);
}

/* Hide default input */
.role-checkbox-input {
    display: none;
}

/* Custom Box */
.custom-box {
    width: 20px;
    height: 20px;
    border: 2px solid var(--accent-green);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

/* Checked State */
.role-checkbox-input:checked+.custom-box {
    background: var(--accent-green);
    box-shadow: 0 0 5px var(--accent-green);
}

/* Check icon (pseudo) */
.custom-box::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
    display: none;
}

.role-checkbox-input:checked+.custom-box::after {
    display: block;
}

/* MOBILE & RESPONSIVE */
#mobile-header {
    display: none;
    background: var(--bg-sidebar);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    /* Use right:0 instead of width:100% to avoid overflow issues */
    height: 60px;
    z-index: 2000;
}

/* Notification Highlight Animation */
@keyframes highlight-pulse {
    0% {
        background-color: rgba(74, 222, 128, 0.3);
        transform: translateX(-5px);
    }

    50% {
        background-color: rgba(74, 222, 128, 0.1);
        transform: translateX(0);
    }

    100% {
        background-color: transparent;
    }
}

.notification-new-highlight {
    animation: highlight-pulse 2s ease-out;
}

@media (max-width: 768px) {
    #mobile-header {
        display: flex;
    }

    #app-screen {
        flex-direction: column;
        min-height: 100vh;
        height: auto;
        padding-top: 60px;
    }

    .sidebar {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 280px;
        height: calc(100% - 60px);
        z-index: 3000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    /* Hide sidebar logo/title on mobile - already shown in header */
    .sidebar>h2 {
        display: none !important;
    }

    /* Ensure logout section is visible */
    .sidebar .user-info {
        margin-top: auto;
        padding: 15px;
        border-top: 1px solid var(--border-color);
    }

    .sidebar.active {
        left: 0;
    }

    /* Overlay effect */
    .sidebar.active::before {
        content: '';
        position: fixed;
        top: 60px;
        left: 280px;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        display: block;
    }

    .main-content {
        padding: 15px;
        width: 100%;
        overflow-x: hidden;
        display: flex;
        flex-direction: column;
        min-height: calc(100vh - 60px);
    }

    .section-view {
        display: none;
    }

    .section-view.active {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        flex: 1;
    }

    /* Hide floating notification BELL on mobile - bell is in mobile header */
    #notification-container #notification-bell {
        display: none !important;
    }

    /* Keep container visible for dropdown positioning */
    #notification-container {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        z-index: 3500 !important;
    }

    /* Notification dropdown - full width on mobile */
    #notification-dropdown {
        position: fixed !important;
        top: 60px !important;
        right: 15px !important;
        left: 15px !important;
        width: auto !important;
        max-width: none !important;
        max-height: calc(100vh - 80px) !important;
    }

    .modal-content {
        width: 95%;
        margin: 0 auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Responsive card */
    .card {
        margin-bottom: 15px;
        width: 100%;
    }

    /* Adjust grid layouts */
    .card>div:first-child {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .card>div:first-child>div {
        width: 100%;
    }

    #busq-usuarios {
        width: 100%;
    }

    /* Responsive tables - horizontal scroll */
    /* Responsive tables - horizontal scroll */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        font-size: 0.85em;
    }

    /* FullCalendar tables MUST be tables to render correctly */
    .fc table {
        display: table !important;
        white-space: normal !important;
    }

    /* Tabs - horizontal scroll */
    .tabs {
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tabs>button {
        flex-shrink: 0;
        font-size: 0.85em;
        padding: 8px 12px;
    }

    /* Calendar - fit to screen */
    #calendar {
        font-size: 0.8em;
    }

    .fc .fc-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .fc .fc-toolbar-title {
        font-size: 1.1em !important;
    }

    /* Chat panel - smaller */
    #modal-chat .modal-content {
        width: 98%;
        height: 95vh;
        max-height: 95vh;
    }

    /* Contact list scrollable in modal */
    #listaAsignarContacto {
        max-height: 40vh;
        overflow-y: auto;
    }

    /* Fix input widths */
    input,
    select,
    textarea {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Zoom button - full width */
    .btn-opc-zoom {
        width: 100%;
        margin-top: 10px;
    }
}

/* Chat Messages */
.msg-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.9em;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}

.msg-me {
    align-self: flex-end;
    background-color: #005c4b;
    color: #e9edef;
    border-bottom-right-radius: 2px;
}

.msg-them {
    align-self: flex-start;
    background-color: #202c33;
    color: #e9edef;
    border-bottom-left-radius: 2px;
}

.msg-time {
    display: block;
    text-align: right;
    font-size: 0.7em;
    opacity: 0.6;
}

/* FLATPICKR OVERRIDES */
.flatpickr-calendar.hasTime .flatpickr-time {
    border-top: 1px solid var(--border-color);
}

.flatpickr-calendar {
    background: var(--bg-card);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover,
.flatpickr-day.selected.prevMonthDay,
.flatpickr-day.startRange.prevMonthDay,
.flatpickr-day.endRange.prevMonthDay,
.flatpickr-day.selected.nextMonthDay,
.flatpickr-day.startRange.nextMonthDay,
.flatpickr-day.endRange.nextMonthDay {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.flatpickr-day:hover {
    background: var(--hover-bg);
    border-color: var(--hover-bg);
}

.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {
    background-color: var(--bg-card);
}

.flatpickr-time input:hover,
.flatpickr-time .flatpickr-am-pm:hover,
.flatpickr-time input:focus,
.flatpickr-time .flatpickr-am-pm:focus {
    background: var(--hover-bg);
}

/* =========================================
   FULLCALENDAR DARK MODE OVERRIDES
   ========================================= */
:root {
    --fc-border-color: var(--border-color);
    --fc-page-bg-color: transparent;
    --fc-neutral-bg-color: rgba(255, 255, 255, 0.05);
    --fc-neutral-text-color: var(--text-secondary);
    --fc-today-bg-color: rgba(16, 185, 129, 0.1);
    --fc-list-event-hover-bg-color: var(--hover-bg);
}

/* General Text & Background */
.fc {
    color: var(--text-primary);
}

.fc-theme-standard th,
.fc-theme-standard td,
.fc-theme-standard .fc-scrollgrid {
    border-color: var(--border-color);
}

/* Headers (Lunes, Martes...) */
.fc-col-header-cell-cushion,
.fc-daygrid-day-number {
    color: var(--text-secondary);
    text-decoration: none;
}

.fc-col-header-cell {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 0;
}

/* Day Cells */
.fc-daygrid-day {
    transition: background 0.2s;
}

.fc-daygrid-day:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Buttons (Prev, Next, Today) - Match App Style */
.fc-button-primary {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
    transition: all 0.2s;
}

.fc-button-primary:hover {
    background-color: var(--hover-bg) !important;
    border-color: var(--text-secondary) !important;
}

.fc-button-primary:not(:disabled).fc-button-active,
.fc-button-primary:not(:disabled):active {
    background-color: var(--accent-green) !important;
    border-color: var(--accent-green) !important;
    color: #fff !important;
}

/* Events */
.fc-event {
    border: none;
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 0.85em;
    cursor: pointer;
}

.fc-daygrid-event-dot {
    border-color: var(--accent-green);
}

/* List View overrides if used */
.fc-list-day-cushion {
    background-color: var(--bg-secondary) !important;
}

.fc-list-event:hover td {
    background-color: var(--hover-bg) !important;
}

/* FullCalendar Week View - Outlook Style */
.fc-timegrid-slot {
    height: 4.5em;
}

.fc-timegrid-slot-label {
    font-size: 0.75em;
    color: var(--text-secondary);
}

.fc-timegrid-event {
    border-radius: 4px !important;
    border: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    padding: 4px 8px !important;
    font-size: 0.9em;
    overflow: visible !important;
    min-height: 40px !important;
}

.fc-timegrid-event .fc-event-main {
    padding: 2px 4px;
    overflow: visible;
    display: flex;
    flex-direction: column;
}

.fc-timegrid-event .fc-event-title {
    font-weight: 700;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    overflow: visible;
    white-space: nowrap;
    font-size: 1.15em;
}

.fc-timegrid-event .fc-event-time {
    font-size: 0.8em;
    opacity: 1;
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Now indicator (current time line) */
.fc-timegrid-now-indicator-line {
    border-color: var(--accent-red) !important;
    border-width: 2px;
}

.fc-timegrid-now-indicator-arrow {
    border-color: var(--accent-red) !important;
    border-top-color: transparent !important;
    border-bottom-color: transparent !important;
}

/* Day headers - Windows Calendar Style */
.fc-timegrid .fc-col-header-cell {
    padding: 8px 5px;
    font-size: 0.85em;
}

.fc-timegrid .fc-col-header-cell-cushion {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

/* Make the date number larger */
.fc-col-header-cell .fc-col-header-cell-cushion {
    font-weight: 300;
}

.fc-timegrid-axis {
    font-size: 0.7em;
    color: var(--text-secondary);
}

/* Today column highlight */
.fc-col-header-cell.fc-day-today {
    background: rgba(16, 185, 129, 0.15) !important;
}

.fc-col-header-cell.fc-day-today .fc-col-header-cell-cushion {
    color: var(--accent-green);
    font-weight: 600;
}

/* Today highlight */
.fc .fc-day-today {
    background-color: rgba(16, 185, 129, 0.08) !important;
}

/* =========================================
   CALENDAR SIDEBAR LAYOUT - OUTLOOK STYLE
   ========================================= */
.calendar-layout {
    display: flex;
    gap: 20px;
    min-height: 600px;
    width: 100%;
}

.calendar-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    max-height: 600px;
}

/* Agenda list scrollable */
.agenda-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

/* Agenda button fixed at bottom */
.calendar-sidebar>button {
    flex-shrink: 0;
    margin-top: 15px;
}

.calendar-main {
    flex: 1;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    padding-bottom: 0;
    border: 1px solid var(--border-color);
    overflow: hidden;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.calendar-main .fc {
    max-height: none;
    width: 100%;
}

.calendar-main #calendar {
    width: 100%;
    flex: 1;
    overflow: hidden;
}

/* Calendar Footer - explicit footer div */
.calendar-footer {
    height: 20px;
    width: 100%;
    flex-shrink: 0;
    background: var(--bg-card);
}

/* Mini Calendar */
.mini-calendar-container {
    margin-bottom: 20px;
}

#mini-calendar {
    font-size: 0.8em;
}

#mini-calendar .fc-toolbar-title {
    font-size: 1.1em !important;
}

#mini-calendar .fc-button {
    padding: 2px 6px !important;
    font-size: 0.85em !important;
}

#mini-calendar .fc-daygrid-day-number {
    font-size: 0.9em;
    padding: 4px;
}

#mini-calendar .fc-daygrid-day-events {
    display: none;
    /* Hide events in mini calendar */
}

#mini-calendar .fc-daygrid-day:hover {
    background: var(--hover-bg);
    cursor: pointer;
}

/* Agenda List */
.agenda-list {
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

.agenda-list h4 {
    color: var(--text-primary);
    margin: 0 0 12px 0;
    font-size: 0.95em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.agenda-list h4::before {
    content: '📅';
}

.agenda-item {
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid var(--accent-green);
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    transition: all 0.2s;
}

.agenda-item:hover {
    background: var(--hover-bg);
    transform: translateX(4px);
}

.agenda-item-time {
    font-size: 0.75em;
    color: var(--accent-green);
    font-weight: 600;
}

.agenda-item-title {
    font-size: 0.85em;
    color: var(--text-primary);
    margin-top: 2px;
}

.agenda-item-date {
    font-size: 0.7em;
    color: var(--text-secondary);
    margin-top: 2px;
}

.agenda-empty {
    color: var(--text-secondary);
    font-size: 0.85em;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Agenda Day Headers - Windows Calendar Style */
.agenda-day-header {
    font-weight: 700;
    font-size: 0.75em;
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 12px 0 6px 0;
    padding-left: 4px;
}

/* Responsive */
@media (max-width: 900px) {
    .calendar-layout {
        flex-direction: column;
        height: auto;
        min-height: auto;
    }

    .calendar-sidebar {
        width: 100%;
    }

    .calendar-main {
        min-height: 500px;
    }

    #calendar {
        min-height: 450px;
    }
}

/* GLOBAL SCROLLBAR FIX (Right Edge) */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 0;
    border: none;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-secondary);
}

/* FULLCALENDAR - Time labels alignment */
/* Move time labels to align WITH the grid lines instead of above them */
.fc-timegrid-slot-label {
    vertical-align: top !important;
    position: relative;
    overflow: visible !important;
}

.fc-timegrid-axis {
    overflow: visible !important;
}

.fc-timegrid-slots,
.fc-timegrid-body {
    overflow: visible !important;
}

/* Force top border on first slot to show 12:00 AM line */
.fc-timegrid-slots table {
    border-top: 1px solid var(--border-color) !important;
}

/* Remove margin-top from FullCalendar tables (global table style has 10px margin) */
.fc table {
    margin-top: 0 !important;
}

/* Hide all-day slot to remove gap between header and time grid */
/* Scoped to TimeGrid views to NOT hide Month view content */
.fc-timeGrid-view .fc-scrollgrid-section-allday,
.fc-timeGrid-view .fc-timegrid-allday,
.fc-timeGrid-view .fc-timegrid-allday-harness,
.fc-timeGrid-view .fc-timegrid-divider,
.fc-timeGrid-view .fc-daygrid-body {
    display: none !important;
}

/* Remove any extra spacing on the scrollgrid */
.fc-scrollgrid {
    margin-top: 0 !important;
}

/* Reduce header cell padding to minimize gap */
.fc-col-header-cell {
    padding: 4px 0 !important;
}

/* Force scroller to start immediately after header */
.fc-scroller.fc-scroller-liquid-absolute {
    top: 0 !important;
}

/* Remove the first empty header section if present */
/* Scoped to #calendar to not affect #mini-calendar */
#calendar .fc-scrollgrid-section-header:first-child:not(:last-of-type) {
    display: none !important;
}

.fc-timegrid-slot-label-cushion {
    position: relative;
    top: -0.7em;
    padding-right: 8px;
    line-height: 1;
}

/* Add triangle arrow after time label */
.fc-timegrid-slot-label-cushion::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 6px solid var(--text-secondary);
    margin-left: 4px;
    vertical-align: middle;
}

/* COLOR PICKER - Event Modal */
.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.color-option:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.color-option.selected {
    border-color: white;
    transform: scale(1.1);
    box-shadow: 0 0 0 2px var(--bg-body), 0 0 10px currentColor;
}

/* FIX EVENT ALIGNMENT */
.fc-timegrid-event {
    margin: 0 !important;
    border: none !important;
    padding: 1px 3px !important;
    /* Reduced for small slots */
    border-radius: 3px;
    box-shadow: none !important;
    overflow: hidden !important;
    /* Strict overflow */
    font-size: 0.75rem !important;
    /* Smaller text */
    line-height: 1.1 !important;
    /* Tight line height */
    min-height: 0 !important;
}

.fc-event-time,
.fc-event-title {
    padding: 0 !important;
    margin: 0 !important;
}

/* Increase Time Slot Height (3x) */
.fc-timegrid-slot {
    height: 75px !important;
}

/* Ensure harness (container) has no spacing */
.fc-timegrid-event-harness {
    margin: 0 !important;
}