/* Agenda Container - 2 Column Layout */
.agenda-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: calc(100vh - 120px) !important;
    max-height: calc(100vh - 120px) !important;
    gap: 0;
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

/* --- SIDEBAR (Left Panel) --- */
.agenda-sidebar {
    background: var(--bg-secondary);
    /* Slightly darker/different than main */
    border-right: 1px solid var(--glass-border);
    padding: 1rem 0.75rem;
    /* Reduced horizontal padding */
    /* Compact padding */
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    /* Minimized structural gap */
    /* Compact gap */
    overflow: hidden !important;
    /* Let children scroll */
    min-height: 0 !important;
    max-height: 100% !important;
    height: 100% !important;
}

/* ... */



/* Sidebar Title/Header */
.agenda-sidebar-header {
    padding: 0 0.5rem;
    margin-bottom: 0.25rem;
}

.agenda-sidebar-header h2 {
    font-size: 1.1rem;
    /* Smaller header */
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.agenda-sidebar-header p {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* Custom Scrollbar for Sidebar */
.agenda-sidebar::-webkit-scrollbar {
    width: 0px;
}

.agenda-sidebar::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

/* Mini Calendar - DENSE VERSION */
.mini-cal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
}

.mini-cal-month {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: capitalize;
    letter-spacing: 0.05em;
}

.mini-cal-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
}

.mini-cal-nav-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.mini-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    /* Tighter grid */
    text-align: center;
    padding: 0 0.25rem;
}

.mini-cal-day-name {
    font-size: 0.65rem;
    color: var(--text-tertiary);
    padding-bottom: 0.25rem;
    font-weight: 600;
}

.mini-cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    height: 28px;
    /* Fixed small height */
    width: 28px;
    margin: 0 auto;
}

.mini-cal-day:hover:not(.empty) {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.mini-cal-day.active {
    background: var(--brand-blue);
    color: white;
    font-weight: 500;
}

.mini-cal-day.active-range {
    background: rgba(14, 165, 233, 0.1);
    color: var(--brand-blue);
}

.mini-cal-day.today {
    color: var(--brand-blue);
    font-weight: 700;
    border: 1px solid var(--brand-blue);
}

.mini-cal-day.empty {
    cursor: default;
}

.mini-cal-day.other-month {
    color: var(--text-tertiary);
    opacity: 0.5;
}

/* --- FILTER CHIPS (Sticky) --- */
.agenda-filters-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    position: sticky;
    /* Sticky positioning */
    top: 0;
    z-index: 10;
    background: var(--bg-secondary);
    padding: 0.5rem 0.5rem 0.25rem 0.5rem;
    margin-bottom: 0px;
}

.filter-chip {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.filter-chip:hover {
    background: rgba(0, 0, 0, 0.06);
}

.filter-chip.active {
    background: white;
    border-color: currentColor;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filter-chip.active:first-child {
    /* Bookings */
    color: #0ea5e9;
    background: #e0f2fe;
    border-color: #0ea5e9;
}

.filter-chip.active:nth-child(2) {
    /* Appointments */
    color: #a855f7;
    background: #f3e8ff;
    border-color: #a855f7;
}

/* Remove old filter styles */
.agenda-filters,
.filter-group-title,
.filter-item,
.filter-checkbox {
    display: none !important;
}

/* Deals / Quick Add Section */
.agenda-quick-add {
    margin-top: auto;
}

.quick-add-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem 0;
    width: 100%;
    transition: color 0.2s;
}

.quick-add-btn:hover {
    color: var(--brand-blue);
}


/* --- MAIN CONTENT (Right Panel) --- */
.agenda-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Toolbar (Top Row) - REFINED */
.agenda-main-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
}

.date-range-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.date-arrow {
    color: var(--text-tertiary);
    font-size: 1.2rem;
}

.header-actions {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

/* View Toggles */
.view-mode-toggle {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-secondary);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.mode-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.mode-btn:hover {
    color: var(--text-primary);
}

.mode-btn.active {
    background: white;
    color: var(--brand-blue);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

/* Nav Controls */
.calendar-nav-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.icon-nav-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
    background: white;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.icon-nav-btn:hover {
    border-color: var(--brand-blue);
    color: var(--brand-blue);
}

.today-btn {
    height: 32px;
    padding: 0 1rem;
    border: 1px solid var(--glass-border);
    background: white;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.today-btn:hover {
    border-color: var(--brand-blue);
    color: var(--brand-blue);
}


/* Timeline Grid */
/* Timeline Grid */
.timeline-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* New Combined Scroll Container */
.timeline-scroll-container {
    flex: 1;
    display: flex;
    overflow: auto;
    scrollbar-gutter: stable;
    /* Keeps space for scrollbar even if not present, ensuring alignment */
}

.time-gutter {
    width: 60px;
    flex-shrink: 0;
    border-right: 1px solid var(--glass-border);
    background: var(--card-bg);
    position: sticky;
    left: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
}

.time-gutter-header {
    height: 96px;
    /* Match the date header height exactly */
    position: sticky;
    top: 0;
    z-index: 11;
    background: var(--card-bg);
    border-right: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
    width: 60px;
    flex-shrink: 0;
    margin-bottom: 12px;
    /* Offset for translateY(-50%) of the first label */
}

.time-slot-label {
    height: 60px;
    /* 1 Hour */
    display: flex;
    align-items: flex-start;
    /* Label at top of line */
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    transform: translateY(-50%);
    /* Center on line */
    padding-top: 4px;
}

.time-slot-label:first-child {
    margin-top: 0;
}

.time-slot-label span {
    background: var(--card-bg);
    padding: 0 4px;
    z-index: 2;
}

.timeline-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Allow shrinking */
}

.timeline-header-row {
    display: grid;
    /* Columns set via JS */
    border-bottom: 1px solid var(--glass-border);
    background: var(--card-bg);
    position: sticky;
    top: 0;
    z-index: 5;
}

.day-col-header {
    text-align: center;
    padding: 1.5rem 0.5rem;
    border-right: 1px solid var(--glass-border);
    min-width: 170px;
    box-sizing: border-box;
}

.day-col-header:last-child {
    border-right: none;
}

.day-col-header.today .day-num {
    color: var(--brand-blue);
    font-weight: 700;
}

.day-col-header.today .day-name {
    color: var(--brand-blue);
}

.day-name {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-tertiary);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.day-num {
    display: block;
    font-size: 1.75rem;
    font-weight: 300;
    color: var(--text-secondary);
    line-height: 1;
}


.main-grid {
    flex: 1;
    display: grid;
    position: relative;
    min-height: calc(24 * 60px);
    width: 100%;
}

/* Grid Lines */
.grid-lines-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    pointer-events: none;
    z-index: 0;
}

.grid-line-hour {
    height: 60px;
    border-bottom: 1px solid var(--glass-border);
    /* Dashed maybe? No, clean solid is better like design */
    border-bottom-style: solid;
    border-color: rgba(0, 0, 0, 0.03);
    /* Very subtle */
}

/* Events Container per Day */
.day-events-col {
    position: relative;
    border-right: 1px solid var(--glass-border);
    /* z-index 10 to sit above grid lines */
}

.day-events-col:last-child {
    border-right: none;
}


/* EVENT CARDS */
.agenda-event {
    position: absolute;
    left: 4px;
    right: 4px;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.1s, box-shadow 0.1s;
    border-left: 3px solid transparent;
    /* Colored Accent */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Slight elevation */
}

.agenda-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 50;
}

/* Event Types / Colors based on Status */
/* Confirmed Booking: Blue/Cyan accent */
.agenda-event.type-booking {
    border-left-color: #3b82f6;
    /* Brighter Blue */
    background: #f8fafc;
    /* Slight off-white */
    color: var(--text-secondary);
}

/* Appointment Type (Purple) */
.agenda-event.type-appointment {
    border-left-color: #a855f7;
    background: rgba(168, 85, 247, 0.1);
}

.agenda-event.type-appointment:hover {
    background: rgba(168, 85, 247, 0.15);
}

.agenda-event.type-appointment .event-title {
    color: #6b21a8;
}

.agenda-event.type-appointment .event-subtitle {
    color: #7c3aed;
}

.agenda-event.type-booking .event-time {
    color: #0ea5e9;
    font-weight: 600;
}

/* Status Variants (overrides) */
.agenda-event.status-confirmed {
    border-left-color: #0ea5e9;
}

/* Blue */
.agenda-event.status-hold {
    border-left-color: #f59e0b;
}

/* Amber */
.agenda-event.status-cancelled {
    border-left-color: #ef4444;
    opacity: 0.7;
}

.event-time {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    display: block;
}

.event-title {
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.event-subtitle {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* Current Time Indicator */
.now-line {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 2px solid #ea4335;
    /* Google Red */
    z-index: 20;
    pointer-events: none;
}

.now-line::before {
    content: '';
    position: absolute;
    left: -5px;
    top: -6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ea4335;
    z-index: 21;
}

.monthly-event-dot:hover {
    background: #bae6fd;
}

.monthly-event-dot.type-booking {
    background: #e0f2fe;
    color: #0369a1;
    border-left: 2px solid #0ea5e9;
}

.monthly-event-dot.status-hold {
    background: #fef3c7;
    color: #92400e;
    border-left: 2px solid #f59e0b;
}

.monthly-event-dot.status-cancelled {
    background: #fee2e2;
    color: #991b1b;
    border-left: 2px solid #ef4444;
    opacity: 0.7;
}

/* --- MONTHLY VIEW --- */
.monthly-view-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.monthly-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--glass-border);
}

.monthly-header-day {
    padding: 1rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.monthly-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: 1fr;
    overflow-y: auto;
    background: var(--glass-border);
    gap: 1px;
}

.monthly-day-box {
    background: white;
    min-height: 120px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.2s;
}

.monthly-day-box:hover {
    background: #f8fafc;
}

.monthly-day-box.other-month {
    background: #f1f5f9;
    color: var(--text-tertiary);
}

.monthly-day-box.today .monthly-day-num {
    background: var(--brand-blue);
    color: white;
}

.monthly-day-num {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.monthly-day-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    max-height: calc(100% - 30px);
}

.monthly-event-dot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    background: #e0f2fe;
    color: #0369a1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.monthly-event-dot:hover {
    background: #bae6fd;
}

.monthly-event-dot.type-booking {
    background: #e0f2fe;
    color: #0369a1;
    border-left: 2px solid #0ea5e9;
}

.monthly-event-dot.type-appointment {
    background: rgba(168, 85, 247, 0.1);
    color: #6b21a8;
    border-left: 2px solid #a855f7;
}

.monthly-event-dot.status-hold {
    background: #fef3c7;
    color: #92400e;
    border-left: 2px solid #f59e0b;
}

.monthly-event-dot.status-cancelled {
    background: #fee2e2;
    color: #991b1b;
    border-left: 2px solid #ef4444;
    opacity: 0.7;
}

.monthly-day-box.has-availability {
    background-color: #f8fafc;
    /* Very light tint for available days */
}

.availability-indicator {
    width: 8px;
    height: 8px;
    background: #22c55e;
    /* Green */
    border-radius: 50%;
    margin-top: 8px;
    margin-right: 4px;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.1);
}

/* --- SIDEBAR EVENT LIST --- */
.agenda-sidebar-list {
    flex: 1;
    overflow-y: auto;
    margin-top: 0;
    /* Remove top margin as Filters are above */
    padding: 0 0.5rem 1rem 0.5rem;
    /* Padding for content */
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    /* min-height handled by flex:1 in column layout */
}

.sidebar-day-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-day-header {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 5;
    padding-bottom: 2px;
}

/* --- SIDEBAR LIST ROW STYLES --- */
.sidebar-event-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.75rem 0.5rem;
    /* Vertical breathing room */
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
    border-radius: 4px;
    /* Slight radius for hover state */
}

/* Remove border from last item in group to keep clean look, or keep it? 
   Let's keep it for separation unless last of entire list. */
.sidebar-day-group .sidebar-event-row:last-child {
    border-bottom: none;
}

.sidebar-event-row:hover {
    background: rgba(0, 0, 0, 0.02);
    /* Subtle hover */
}

/* Selected State (Optional, can be added via JS later) 
.sidebar-event-row.selected {
    background: rgba(0, 0, 0, 0.04);
    box-shadow: inset 3px 0 0 var(--brand-blue);
}
*/

/* Time Column */
.sidebar-row-time {
    width: 36px;
    /* Fixed width */
    flex-shrink: 0;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-row-time span {
    font-size: 0.75rem;
    /* ~12px */
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1;
}

.sidebar-row-time .end-time {
    font-size: 0.7rem;
    color: var(--text-tertiary);
}

/* Indicator Dot */
.sidebar-row-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 3px;
    /* Align with first line of text */
    flex-shrink: 0;
}

.sidebar-row-dot.type-booking {
    background-color: #0ea5e9;
    box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.2);
}

.sidebar-row-dot.type-appointment {
    background-color: #a855f7;
    box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.2);
}

/* Content Column */
.sidebar-row-content {
    flex: 1;
    min-width: 0;
    /* Enable truncation */
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-row-title {
    font-size: 0.9rem;
    /* ~14px */
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-row-subtitle {
    font-size: 0.75rem;
    /* ~12px */
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-empty-state {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    text-align: center;
    padding: 2rem 0;
    font-style: italic;
}