/* HEADER STYLES                              */
/* Top bar: logo, nav, month title, view      */
/* toggle, language switch, quick-action btn. */

.calendar-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    min-height: 64px;
    background: white;
    border-bottom: none;
    position: relative;
    z-index: 10000;
    flex-wrap: wrap;
    gap: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-radius: 0 0 16px 16px;
    flex-shrink: 0;
    overflow: visible;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
}

.nav-arrow {
    background: none;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    color: #333;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.nav-arrow:hover {
    color: var(--calendar-green);
    background: var(--light-bg);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-arrow:active {
    transform: scale(0.95);
}

.header-title {
    font-size: 1.1rem;
    color: #1a1a1a;
    white-space: nowrap;
    margin: 0;
    line-height: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

/* Month/Year picker */
.hdp-wrap {
    position: relative;
}
button.header-title.hdp-trigger {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0 8px;
    border-radius: 8px;
    font-weight: 700;
    transition: background 0.15s, color 0.15s;
    gap: 6px;
}
button.header-title.hdp-trigger:hover {
    background: var(--light-bg);
    color: var(--calendar-green);
}
.hdp-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    min-width: 240px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    z-index: 9999;
    padding: 14px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s, transform 0.18s, visibility 0s linear 0.18s;
}
.hdp-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    transition: opacity 0.18s, transform 0.18s;
}
.hdp-year-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.hdp-yr-label {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
}
.hdp-yr-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
}
.hdp-yr-btn:hover {
    border-color: var(--calendar-green);
    color: var(--calendar-green);
    background: #f0fdf4;
}
.hdp-months {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.hdp-month-btn {
    padding: 8px 4px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.12s;
    text-align: center;
}
.hdp-month-btn:hover {
    border-color: var(--calendar-green);
    color: var(--calendar-green);
    background: #f0fdf4;
}
.hdp-month-btn.active {
    background: var(--calendar-green);
    border-color: var(--calendar-green);
    color: #fff;
    font-weight: 700;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex: 1;
    justify-content: flex-end;
    overflow: visible;
}

.lunar-info {
    font-size: 0.95rem;
    color: #1a1a1a;
    font-weight: 500;
    white-space: nowrap;
    height: 36px;
    line-height: 36px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.lang-toggle {
    position: relative;
    display: flex;
    align-items: center;
    padding: 3px;
    height: 30px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0;
    transition: all 0.2s;
    white-space: nowrap;
}

.lang-toggle:hover {
    border-color: #d1d5db;
}

.lang-option {
    position: relative;
    z-index: 1;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    transition: color 0.2s;
    user-select: none;
}

.lang-option.active {
    color: white;
}

.lang-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(50% - 3px);
    height: calc(100% - 6px);
    background: var(--calendar-green);
    border-radius: 16px;
    transition: left 0.25s ease;
}

.lang-toggle.kh .lang-slider {
    left: calc(50%);
}

/* APPOINTMENTS HEADER CONTROLS */

.appointments-header-controls {
    background: white;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    z-index: 100;
    flex-shrink: 0;
}

.sidebar-header-row1 {
    display: flex;
    align-items: center;
    gap: 0;
}

.sidebar-header-row2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header-row1 #newAppointmentBtn {
    margin-left: auto;
}

.appointments-title {
    font-size: large;
    font-weight: 700;
    color: black;
    margin: 0;
    white-space: nowrap;
}

.header-divider {
    color: gray;
    font-weight: 300;
    font-size: 1.1rem;
}

.appointments-month {
    font-size: 0.9rem;
    color: #1f2937;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: auto;
    max-width: 200px;
    flex: 0 1 auto;
}

/* Header Filter Checkbox */
.header-filter-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.82rem;
    color: #374151;
    padding: 5px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
    border: 1px solid transparent;
}

.header-filter-checkbox:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

.header-filter-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #586277;
}

.header-filter-checkbox .filter-label {
    font-weight: 500;
    font-size: 0.82rem;
}

/* Color-coded checkboxes per filter */
.filter-all input[type="checkbox"] { accent-color: var(--calendar-green); }
.filter-appointment input[type="checkbox"] { accent-color: #3b82f6; }
.filter-queue input[type="checkbox"] { accent-color: #f59e0b; }
.filter-cancelled input[type="checkbox"] { accent-color: #ef4444; }

/* Fixed width so filter buttons never change size */
.filter-appointment,
.filter-queue,
.filter-cancelled {
    min-width: 80px;
}

/* Header Provider Filter */
.header-provider-filter {
    position: relative;
}

.header-provider-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: #374151;
    transition: all 0.2s;
    white-space: nowrap;
}

.header-provider-btn:hover {
    border-color: var(--calendar-green);
    background: #f9fafb;
}

.header-provider-btn i.fa-chevron-down {
    font-size: 0.6rem;
    color: #9ca3af;
    transition: transform 0.2s;
}

.header-provider-btn i.fa-user-md {
    font-size: 0.75rem;
    color: #6b7280;
}

.header-provider-dropdown {
    display: none;
    position: fixed;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    max-height: 400px;
    overflow: hidden;
    z-index: 15000;
}

.filter-provider-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}

.filter-provider-search i {
    color: #9ca3af;
    font-size: 0.9rem;
}

.filter-provider-search input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.85rem;
    font-weight: 400;
    color: #374151;
}

.filter-provider-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}

.filter-action-btn {
    flex: 1;
    padding: 0.4rem;
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s;
}

.filter-action-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
}

.header-provider-dropdown .filter-provider-list {
    display: block !important;
    padding: 0.5rem;
    max-height: 280px;
    overflow-y: auto;
}

.header-provider-dropdown .provider-filter-item {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
}

.header-provider-dropdown .provider-filter-item.search-hidden {
    display: none !important;
}

.header-provider-dropdown .provider-filter-item:hover {
    background: #f9fafb;
}

.header-provider-dropdown .provider-filter-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    border: 1.5px solid #d1d5db;
    border-radius: 3px;
    background: white;
    position: relative;
    flex-shrink: 0;
    transition: all 0.15s;
}

.header-provider-dropdown .provider-filter-item input[type="checkbox"]:checked {
    background: var(--calendar-green);
    border-color: var(--calendar-green);
}

.header-provider-dropdown .provider-filter-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4.5px;
    top: 1.5px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.header-provider-dropdown .provider-color {
    display: inline-block !important;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.header-provider-dropdown .provider-name {
    display: inline-block !important;
    font-size: 0.85rem;
    font-weight: 400;
    color: #374151;
    flex: 1;
}

/* Header Status Filters */
.header-status-filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem;
    background: #f9fafb;
    border-radius: 8px;
}

/* Header Action Button */
.header-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    height: 32px;
    /* padding: 0 0.7rem; */
    background: var(--calendar-green);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s, opacity 0.15s;
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 179, 0, 0.2);
}

.header-action-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 179, 0, 0.3);
}

.header-action-btn:active {
    transform: translateY(0);
}

.header-action-btn i {
    font-size: 0.7rem;
}

#appointmentsHeaderControls #newAppointmentBtn {
    height: 32px;
    padding: 0 0.9rem;
    font-size: 0.82rem;
    border-radius: 7px;
}

/* UNIFIED SIDEBAR FILTERS DROPDOWN           */

.sidebar-options-wrap {
    position: relative;
    flex-shrink: 0;
}

.sidebar-options-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: #374151;
    transition: all 0.2s;
    white-space: nowrap;
}

.sidebar-options-btn:hover,
.sidebar-options-btn.active {
    border-color: var(--calendar-green);
    background: #f0fdf4;
    color: #15803d;
}

.sidebar-options-btn i.fa-sliders-h {
    font-size: 0.75rem;
    color: #6b7280;
}

.sidebar-opts-chevron {
    font-size: 0.6rem !important;
    color: #9ca3af;
    transition: transform 0.2s;
}

.sidebar-options-btn.active .sidebar-opts-chevron {
    transform: rotate(180deg);
}

.sidebar-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--calendar-green);
    color: white;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
}

.sidebar-options-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    min-width: 260px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 15000;
}

.sidebar-opts-section {
    padding: 10px 12px;
}

.sidebar-opts-divider {
    height: 1px;
    background: #f3f4f6;
}

.sidebar-opts-section-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    gap: 6px;
}

.sidebar-opts-section-hd i {
    font-size: 0.7rem;
    color: #6b7280;
}

.sidebar-opts-link {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.7rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
}

.sidebar-opts-link:hover {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}

.sidebar-opts-new-btn {
    width: 100%;
    height: 34px;
    justify-content: center;
    font-size: 0.85rem;
    border-radius: 8px;
}

/* Override fixed-position when filter lists are embedded inside the dropdown */
.sidebar-opts-inner-list {
    display: block !important;
    position: static !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    min-width: auto !important;
    max-height: none !important;
    z-index: auto !important;
    overflow: visible !important;
}

/* View Toggle */
.view-toggle {
    display: flex;
    background: var(--calendar-green);
    border-radius: 12px;
    padding: 5px;
    gap: 2px;
    height: 32px;
    align-items: center;
}

.view-btn {
    background: none;
    border: none;
    padding: 0 0.6rem;
    height: 24px;
    border-radius: 12px;
    cursor: pointer;
    color: white;
    transition: all 0.2s;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover {
    color: white;
}

.view-btn.active {
    background: white; 
    color: var(--calendar-green);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Primary Action Button */
.primary-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid #10b981;
    background: #10b981;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.primary-action-btn i {
    font-size: 14px;
}

.primary-action-btn:hover {
    background: #059669;
    border-color: #059669;
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.primary-action-btn:active {
    transform: translateY(1px);
}

/* Quick Action Dropdown */
.quick-action-wrapper {
    position: relative;
    z-index: 10;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0 0.75rem;
    height: 32px;
    background: var(--calendar-green);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.78rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 179, 0, 0.2);
    white-space: nowrap;
}

.quick-action-btn:hover {
    background: var(--calendar-green-dark);
    box-shadow: 0 4px 8px rgba(0, 179, 0, 0.3);
    transform: translateY(-1px);
}

.quick-action-btn:active {
    transform: translateY(0);
}

.quick-action-btn i {
    font-size: 0.85rem;
}

.quick-action-btn[aria-expanded="true"] {
    background: var(--calendar-green-dark);
}

.quick-action-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    /* max-width: 320px; */
    z-index: 20000;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px);
    transition: all 0.3s ease;
}

.quick-action-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.quick-action-header {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.quick-action-menu {
    padding: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.quick-action-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 0.8rem 1rem;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    color: var(--text-dark);
}

.quick-action-item:hover {
    background: var(--light-bg);
    transform: translateX(4px);
}

.quick-action-item:active {
    background: #e9ecef;
}

.quick-action-item i {
    font-size: 1.2rem;
    color: var(--calendar-green);
    width: 24px;
    text-align: center;
}

.quick-action-item .action-label {
    font-size: 0.9rem;
    font-weight: 500;
}

.quick-action-item:focus {
    outline: none;
    background: var(--light-bg);
}
.quick-action-item:focus-visible {
    outline: 2px solid var(--calendar-green);
    outline-offset: -2px;
}

/* Close Shift button */
.close-shift-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0 0.75rem;
    height: 32px;
    background: var(--calendar-green);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.78rem;
    font-family: inherit;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 179, 0, 0.2);
    white-space: nowrap;
    flex-shrink: 0;
}
.close-shift-btn:hover {
    background: var(--calendar-green-dark);
    box-shadow: 0 4px 8px rgba(0, 179, 0, 0.3);
    transform: translateY(-1px);
}
.close-shift-btn:active {
    transform: translateY(0);
}