/* ============================================
   SKELLIA DENTAL - APPOINTMENTS STYLES
   ============================================ */

.appointments-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--spacing-lg);
    height: calc(100vh - var(--header-height) - var(--spacing-xl) * 2 - 80px);
}

@media (max-width: 1200px) {
    .appointments-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
}

.view-toggle {
    display: flex;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    padding: 4px;
}

.view-toggle-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-base);
}

.view-toggle-btn:hover {
    color: var(--text-primary);
}

.view-toggle-btn.active {
    background: var(--brand-blue);
    color: white;
}

.calendar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 600px;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.calendar-nav-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
}

.calendar-nav-btn:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}

.calendar-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
    min-width: 200px;
    text-align: center;
}

.calendar-today-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--brand-blue);
    background: rgba(79, 143, 186, 0.15);
    border: 1px solid rgba(79, 143, 186, 0.3);
    border-radius: var(--radius-md);
    cursor: pointer;
}

.calendar-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-default);
}

.calendar-weekday {
    padding: var(--spacing-md);
    text-align: center;
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.calendar-days {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
}

.calendar-day {
    border-right: 1px solid var(--border-muted);
    border-bottom: 1px solid var(--border-muted);
    padding: var(--spacing-sm);
    min-height: 100px;
    cursor: pointer;
    transition: background var(--transition-base);
}

.calendar-day:nth-child(7n) {
    border-right: none;
}

.calendar-day:hover {
    background: var(--surface-2);
}

.calendar-day.other-month {
    background: var(--surface-0);
}

.calendar-day.other-month .day-number {
    color: var(--text-tertiary);
}

.calendar-day.today {
    background: rgba(79, 143, 186, 0.1);
}

.calendar-day.today .day-number {
    background: var(--brand-blue);
    color: white;
}

.calendar-day.selected {
    background: rgba(201, 169, 98, 0.1);
    border-color: var(--brand-gold);
}

.day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-primary);
    border-radius: var(--radius-full);
    margin-bottom: var(--spacing-xs);
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.day-event {
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 500;
    background: rgba(79, 143, 186, 0.2);
    color: var(--brand-blue);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.day-event.completed {
    background: var(--success-bg);
    color: var(--success);
}

.day-event.cancelled {
    background: var(--danger-bg);
    color: var(--danger);
    text-decoration: line-through;
}

.day-events-more {
    font-size: 10px;
    color: var(--text-tertiary);
    padding: 2px 6px;
}

.appointment-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.appointment-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

@media (max-width: 480px) {
    .appointment-form .form-row {
        grid-template-columns: 1fr;
    }
}

.time-slots {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.time-slot {
    padding: var(--spacing-sm);
    text-align: center;
    font-size: var(--font-size-sm);
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
}

.time-slot:hover:not(.booked) {
    background: var(--surface-3);
    border-color: var(--brand-blue);
    color: var(--text-primary);
}

.time-slot.selected {
    background: var(--brand-blue);
    border-color: var(--brand-blue);
    color: white;
}

.time-slot.booked {
    background: var(--surface-1);
    color: var(--text-tertiary);
    cursor: not-allowed;
    text-decoration: line-through;
}

.appointment-types {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.appointment-type-option {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
}

.appointment-type-option:hover {
    background: var(--surface-3);
    border-color: var(--brand-blue);
}

.appointment-type-option.selected {
    background: rgba(79, 143, 186, 0.15);
    border-color: var(--brand-blue);
    color: var(--brand-blue);
}

.filters-bar {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.filter-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* Clickable day number */
.day-number {
    cursor: pointer;
    transition: all var(--transition-base);
}

.day-number:hover {
    background: var(--surface-3);
    transform: scale(1.1);
}

.calendar-day.today .day-number:hover {
    background: var(--brand-gold);
}

/* Clickable events */
.day-event {
    cursor: pointer;
    transition: all var(--transition-base);
}

.day-event:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.day-events-more {
    cursor: pointer;
}

.day-events-more:hover {
    color: var(--brand-blue);
}

/* Day summary header in popup */
.day-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-muted);
}

.day-summary-count {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    background: var(--surface-2);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-full);
}

/* ============================================
   WEEK VIEW STYLES
   ============================================ */
.week-view {
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.week-header {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-default);
}

.week-hour-label {
    padding: var(--spacing-sm);
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    text-align: right;
    padding-right: var(--spacing-md);
    min-width: 60px;
}

.week-day-header {
    padding: var(--spacing-md);
    text-align: center;
    cursor: pointer;
    transition: background var(--transition-base);
    border-left: 1px solid var(--border-muted);
}

.week-day-header:hover {
    background: var(--surface-3);
}

.week-day-header.today {
    background: rgba(79, 143, 186, 0.15);
}

.week-day-name {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.week-day-number {
    display: block;
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.week-day-header.today .week-day-number {
    color: var(--brand-blue);
}

.week-grid {
    max-height: 500px;
    overflow-y: auto;
}

.week-row {
    display: grid;
    grid-template-columns: 60px repeat(7, 1fr);
    border-bottom: 1px solid var(--border-muted);
}

.week-row:last-child {
    border-bottom: none;
}

.week-cell {
    border-left: 1px solid var(--border-muted);
    min-height: 40px;
    padding: 2px;
    cursor: pointer;
    transition: background var(--transition-base);
}

.week-cell:hover {
    background: rgba(79, 143, 186, 0.05);
}

.week-event {
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 500;
    background: rgba(79, 143, 186, 0.2);
    color: var(--brand-blue);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    margin-bottom: 2px;
}

.week-event:hover {
    background: var(--brand-blue);
    color: white;
}

.week-event.completed {
    background: var(--success-bg);
    color: var(--success);
}

.week-event.cancelled {
    background: var(--danger-bg);
    color: var(--danger);
    text-decoration: line-through;
}

/* ============================================
   DAY VIEW STYLES
   ============================================ */
.day-view {
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.day-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-default);
}

.day-view-header h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.day-view-grid {
    max-height: 550px;
    overflow-y: auto;
}

.day-view-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
    /* Visible dashed line for :30 */
}

html[data-theme="dark"] .day-view-row {
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.day-view-row:nth-child(even) {
    background-color: rgba(79, 143, 186, 0.04);
}

html[data-theme="dark"] .day-view-row:nth-child(even) {
    background-color: rgba(79, 143, 186, 0.1);
}

.day-view-row.hour-start {
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
    /* Solid darker line for exact hour */
}

html[data-theme="dark"] .day-view-row.hour-start {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    /* Solid darker line for exact hour */
}

.day-view-row:last-child {
    border-bottom: none;
}

.day-view-time {
    padding: 0 var(--spacing-md) 0 0;
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    text-align: right;
    background: var(--surface-0);
    border-right: 1px solid var(--border-muted);
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.day-view-slot {
    height: 40px;
    box-sizing: border-box;
    padding: 0 var(--spacing-xs);
    cursor: pointer;
    transition: background var(--transition-base);
}

.day-view-slot:hover {
    background: rgba(79, 143, 186, 0.05);
}

.day-event-card {
    background: var(--brand-blue);
    color: white;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.day-event-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    z-index: 10 !important;
}

.day-event-card.completed {
    background: var(--success);
}

.day-event-card.cancelled {
    background: var(--danger);
    opacity: 0.7;
}

.day-event-patient {
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.day-event-type {
    font-size: var(--font-size-xs);
    opacity: 0.9;
}

.day-event-duration {
    font-size: var(--font-size-xs);
    opacity: 0.7;
}

/* ============================================
   FULLWIDTH CALENDAR LAYOUT
   ============================================ */

.appointments-fullwidth {
    padding: 0;
}

.appointments-fullwidth .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--surface-1);
    border-bottom: 1px solid var(--border-default);
    margin-bottom: 0;
}

.calendar-header-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.calendar-filters {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.view-filter-dropdown {
    min-width: 120px;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
}

.calendar-fullwidth-container {
    height: calc(100vh - var(--header-height) - 100px);
    overflow: hidden;
}

/* ============================================
   IMPROVED WEEK VIEW
   ============================================ */

.week-view-improved {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--surface-1);
    border: 1px solid var(--border-default);
}

.week-view-improved .week-header {
    display: flex;
    background: var(--surface-2);
    border-bottom: 2px solid var(--border-default);
    position: sticky;
    top: 0;
    z-index: 10;
}

.week-view-improved .week-hour-label {
    width: 70px;
    min-width: 70px;
    padding: 0 var(--spacing-md) 0 0;
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    text-align: right;
    border-right: 1px solid var(--border-muted);
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.week-view-improved .week-day-header {
    flex: 1;
    padding: var(--spacing-md) var(--spacing-sm);
    text-align: center;
    border-left: 1px solid var(--border-muted);
    cursor: pointer;
    transition: background var(--transition-base);
}

.week-view-improved .week-day-header:hover {
    background: var(--surface-3);
}

.week-view-improved .week-day-header.today {
    background: rgba(79, 143, 186, 0.15);
}

.week-view-improved .week-day-header.today .week-day-name {
    color: var(--brand-blue);
    font-weight: 700;
}

.week-view-improved .week-day-name {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.week-view-improved .week-grid {
    flex: 1;
    overflow-y: auto;
}

.week-view-improved .week-row {
    display: flex;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
    /* Visible dashed line for :30 */
    height: 40px;
    box-sizing: border-box;
}

html[data-theme="dark"] .week-view-improved .week-row {
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.week-view-improved .week-row:nth-child(even) {
    background-color: rgba(79, 143, 186, 0.04);
}

html[data-theme="dark"] .week-view-improved .week-row:nth-child(even) {
    background-color: rgba(79, 143, 186, 0.1);
}

.week-view-improved .week-row.hour-start {
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
    /* Solid darker line for exact hour */
}

html[data-theme="dark"] .week-view-improved .week-row.hour-start {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    /* Solid darker line for exact hour */
}

.week-view-improved .week-cell {
    flex: 1;
    border-left: 1px solid var(--border-muted);
    padding: 0;
    cursor: pointer;
    transition: background var(--transition-base);
    height: 40px;
    box-sizing: border-box;
}

.week-view-improved .week-cell:hover {
    background: rgba(79, 143, 186, 0.15);
}

.week-view-improved .week-event {
    padding: 4px 8px;
    margin: 2px;
    font-size: 11px;
    background: var(--brand-blue);
    border-radius: var(--radius-sm);
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: all var(--transition-base);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.week-view-improved .week-event:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    z-index: 10 !important;
}

.week-view-improved .week-event.completed {
    background: var(--success);
}

.week-view-improved .week-event.cancelled {
    background: var(--danger);
    text-decoration: line-through;
    opacity: 0.7;
}

.week-event-time {
    font-weight: 600;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.9);
}

.week-event-patient {
    font-weight: 500;
}

.week-event-type {
    font-size: 10px;
    opacity: 0.7;
}

/* ============================================
   NEW APPOINTMENT MODAL
   ============================================ */

#newAppointmentModal.active {
    display: flex;
}

.appointment-modal-content {
    width: 420px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--surface-1);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 0;
    position: relative;
}

.appointment-modal-content .modal-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 24px;
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: all var(--transition-base);
    z-index: 10;
}

.appointment-modal-content .modal-close:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}

.appointment-modal-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-default);
    padding: var(--spacing-md) var(--spacing-lg);
    padding-right: 50px;
    gap: var(--spacing-lg);
}

.modal-tab {
    background: none;
    border: none;
    padding: var(--spacing-sm) 0;
    font-size: var(--font-size-md);
    font-weight: 500;
    color: var(--text-tertiary);
    cursor: pointer;
    position: relative;
    transition: color var(--transition-base);
}

.modal-tab:hover {
    color: var(--text-secondary);
}

.modal-tab.active {
    color: var(--success);
}

.modal-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--success);
    border-radius: 2px;
}

.modal-appointment-form {
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.modal-appointment-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-default);
}

/* ============================================
   PATIENT SEARCH DROPDOWN IN MODAL
   ============================================ */

.patient-search-container {
    position: relative;
}

.modal-patient-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: var(--surface-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    margin-top: 4px;
}

.modal-patient-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-base);
}

.modal-patient-option:last-child {
    border-bottom: none;
}

.modal-patient-option:hover {
    background: var(--surface-3);
}

.patient-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    flex-shrink: 0;
}

.modal-patient-option.add-new-patient {
    background: rgba(244, 67, 54, 0.08);
    border-top: 2px solid var(--border-default);
}

.modal-patient-option.add-new-patient:hover {
    background: rgba(244, 67, 54, 0.15);
}

.add-patient-icon {
    background: var(--danger) !important;
}

.add-patient-icon span {
    font-size: 16px;
    font-weight: 700;
}

/* ============================================
   QUICK PATIENT FORM MODAL
   ============================================ */

#quickPatientFormModal.active {
    display: flex;
}

.patient-form-modal-content {
    width: 480px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--surface-1);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--spacing-xl);
    position: relative;
}

.patient-form-modal-content h2 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.patient-form-modal-content .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.patient-form-modal-content .form-group {
    margin-bottom: var(--spacing-md);
}

.patient-form-modal-content .modal-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 24px;
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: all var(--transition-base);
}

.patient-form-modal-content .modal-close:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}

/* ============================================
   GENDER OPTIONS
   ============================================ */

.gender-options {
    display: flex;
    gap: var(--spacing-lg);
}

.gender-option {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    transition: background var(--transition-base);
}

.gender-option:hover {
    background: var(--surface-3);
}

.gender-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand-blue);
    cursor: pointer;
}

.gender-label {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

/* ============================================
   APPOINTMENT MODAL TITLE
   ============================================ */

.appointment-modal-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
    padding: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-default);
    margin: 0;
}

/* ============================================
   APPOINTMENTS MAIN LAYOUT WITH WAITING ROOM
   ============================================ */

.appointments-main-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: var(--spacing-md);
    height: calc(100vh - var(--header-height) - 100px);
    overflow: hidden;
}

@media (max-width: 1200px) {
    .appointments-main-layout {
        grid-template-columns: 1fr;
    }

    .waiting-room-sidebar {
        display: none;
        /* Hide on mobile - can add toggle later */
    }
}

/* ============================================
   WAITING ROOM SIDEBAR
   ============================================ */

.waiting-room-sidebar {
    background: var(--surface-1);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.waiting-room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-default);
}

.waiting-room-header h3 {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.waiting-room-count {
    background: var(--brand-gold);
    color: var(--brand-dark);
    font-size: var(--font-size-sm);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    min-width: 24px;
    text-align: center;
}

.waiting-room-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-sm);
}

.waiting-room-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--text-tertiary);
}

.waiting-room-empty-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.waiting-room-empty p {
    margin: 0;
    font-size: var(--font-size-sm);
}

/* Waiting Room Patient Card */
.waiting-room-patient {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    background: linear-gradient(135deg, #F9D56E 0%, #F5C34B 100%);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.waiting-room-patient.in-treatment {
    background: linear-gradient(135deg, #6BCB77 0%, #4CAF50 100%);
}

.waiting-room-position {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: var(--font-size-sm);
    color: var(--brand-dark);
}

.waiting-room-patient-info {
    flex: 1;
    min-width: 0;
}

.waiting-room-patient-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--brand-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.waiting-room-patient-time {
    font-size: var(--font-size-xs);
    color: rgba(0, 0, 0, 0.6);
    margin-top: 2px;
}

.waiting-room-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 14px;
    color: var(--brand-dark);
    transition: all var(--transition-base);
}

.waiting-room-action-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.1);
}

.waiting-room-action-btn.in-treatment {
    background: rgba(255, 255, 255, 0.8);
    color: #2E7D32;
}

/* ============================================
   ADD TO WAITING ROOM BUTTON
   ============================================ */

.btn-waiting-room {
    width: 100%;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    background: linear-gradient(135deg, #F9D56E 0%, #F5C34B 100%);
    border: none;
    border-radius: var(--radius-md);
    color: var(--brand-dark);
    font-weight: 600;
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-waiting-room:hover {
    background: linear-gradient(135deg, #F5C34B 0%, #F0B429 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ============================================
   PATIENT NAME LINKS
   ============================================ */

.patient-link {
    color: var(--brand-blue);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}

.patient-link:hover {
    color: var(--accent-primary);
    text-decoration-style: solid;
}

/* ============================================
   APPOINTMENT HOVER TOOLTIP
   ============================================ */
.appointment-custom-tooltip {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--surface-1);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    box-shadow: var(--shadow-xl);
    width: max-content;
    max-width: 250px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    color: var(--text-primary);
    text-align: left;
    white-space: normal;
}

/* Caret/Arrow */
.appointment-custom-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: var(--surface-1) transparent transparent transparent;
}

.appointment-custom-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 7px;
    border-style: solid;
    border-color: var(--border-muted) transparent transparent transparent;
    margin-top: 1px;
}

.week-event:hover .appointment-custom-tooltip,
.day-event-card:hover .appointment-custom-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.tooltip-header {
    border-bottom: 1px solid var(--border-muted);
    padding-bottom: 6px;
    margin-bottom: 6px;
}

.tooltip-patient {
    font-weight: 700;
    font-size: var(--font-size-sm);
    color: var(--brand-blue);
}

.tooltip-row {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-bottom: 4px;
    line-height: 1.4;
}

.tooltip-row strong {
    color: var(--text-primary);
    font-weight: 600;
}

.waiting-room-patient-name {
    transition: color var(--transition-base);
}

.waiting-room-patient-name:hover {
    color: var(--brand-blue);
    text-decoration: underline;
}