/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* === Design Tokens — Dental Clinic === */
:root {
    --teal: #0097a7;
    --teal-dark: #00796b;
    --teal-light: #e0f7fa;
    --teal-glow: rgba(0, 151, 167, 0.15);

    --navy: #1a3c50;
    --navy-light: #2a5c74;

    --warm: #f5f0eb;
    --warm-dark: #e8ddd4;

    --accent-blue: #2a7de1;
    --accent-purple: #7c5cbf;
    --accent-green: #2e9e6e;
    --accent-red: #d94040;
    --accent-amber: #e89c30;

    --text: #1a3c50;
    --text-light: #6b8599;
    --text-muted: #9fb3c2;

    --bg: #f7f9fb;
    --card: #ffffff;
    --border: #e4eaf0;
    --border-light: #f0f3f6;

    --now-line: #d94040;
    --slot-height: 30px;

    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;

    --radius: 14px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(26, 60, 80, 0.06);
    --shadow-md: 0 4px 16px rgba(26, 60, 80, 0.08);
    --shadow-lg: 0 8px 32px rgba(26, 60, 80, 0.1);
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === CTA Bar === */
#cta-bar {
    background: linear-gradient(135deg, var(--navy) 0%, var(--teal-dark) 100%);
    color: #ffffff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}
.cta-bar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.cta-bar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.cta-tooth {
    width: 28px;
    height: 28px;
    color: var(--teal-light);
    flex-shrink: 0;
}
.cta-bar-text {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
}
.cta-bar-text strong {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.cta-bar-sub {
    font-size: 0.78rem;
    opacity: 0.75;
    font-weight: 400;
}
.cta-bar-phone {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--teal);
    border: none;
    color: #ffffff;
    padding: 0.55rem 1.4rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 151, 167, 0.3);
}
.cta-bar-phone:hover {
    background: #00acc1;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 151, 167, 0.4);
}
.cta-bar-phone-icon {
    font-size: 1rem;
}

/* === Dashboard === */
#dashboard {
    display: flex;
    gap: 1.25rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
    flex: 1;
    width: 100%;
    min-height: 0;
}

/* Calendar Container */
#calendar-container {
    flex: 3;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    box-shadow: var(--shadow-sm);
}
.calendar-header {
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
}
.calendar-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.calendar-nav button {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text);
    font-family: var(--font-body);
    transition: all 0.15s;
}
.calendar-nav button:hover {
    background: var(--teal-light);
    border-color: var(--teal);
    color: var(--teal-dark);
}
.today-btn {
    font-size: 0.75rem !important;
    font-weight: 600;
    color: var(--teal) !important;
}
#day-label {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 500;
    color: var(--navy);
    min-width: 220px;
    text-align: center;
}
.calendar-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: var(--text-light);
    font-weight: 500;
}
.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block;
}

/* Calendar Scroll */
.calendar-scroll {
    flex: 1;
    overflow-y: auto;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.calendar-scroll::-webkit-scrollbar { width: 5px; }
.calendar-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: 56px repeat(var(--staff-count, 4), 1fr);
    gap: 0;
    position: relative;
}

/* Header cells */
.grid-header-time {
    background: var(--warm);
    padding: 0.5rem 0.25rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 5;
}
.grid-header-staff {
    background: var(--warm);
    padding: 0.5rem 0.35rem;
    text-align: center;
    font-weight: 700;
    font-size: 0.78rem;
    border-bottom: 2px solid var(--border);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 5;
    line-height: 1.3;
}
.grid-header-staff .staff-title {
    display: block;
    font-weight: 400;
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Time cells */
.grid-time {
    background: var(--bg);
    padding: 0 0.35rem;
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: right;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    border-right: 1px solid var(--border);
    min-height: var(--slot-height);
    padding-top: 2px;
    font-variant-numeric: tabular-nums;
}

/* Calendar cells */
.grid-cell {
    min-height: var(--slot-height);
    border-bottom: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    position: relative;
    padding: 0 1px;
    transition: background 0.15s;
}
.grid-cell.hour-start {
    border-top: 1px solid var(--border);
}
.grid-cell.lunch {
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 4px,
        var(--warm) 4px,
        var(--warm) 5px
    );
}
.grid-cell.empty-slot {
    background: #fcfdfe;
}
.grid-cell.empty-slot:hover {
    background: var(--teal-glow);
}

/* Appointment blocks */
.grid-appt {
    position: absolute;
    left: 2px;
    right: 2px;
    border-radius: 5px;
    padding: 3px 6px;
    font-size: 0.68rem;
    color: #ffffff;
    overflow: hidden;
    z-index: 3;
    box-shadow: var(--shadow-sm);
    cursor: default;
    line-height: 1.3;
    transition: box-shadow 0.2s, transform 0.15s;
    border-left: 3px solid rgba(0,0,0,0.15);
}
.grid-appt:hover {
    box-shadow: var(--shadow-md);
    transform: scale(1.02);
    z-index: 4;
}
.grid-appt .appt-name {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.grid-appt .appt-treat {
    opacity: 0.9;
    font-size: 0.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Treatment colors */
.treat-exam { background: var(--accent-blue); border-left-color: #1a5cc0; }
.treat-fill { background: var(--accent-purple); border-left-color: #5a3d9e; }
.treat-clean { background: var(--accent-green); border-left-color: #1e7a52; }
.treat-urgent { background: var(--accent-red); border-left-color: #b52e2e; }

/* New booking highlight */
.grid-appt.new-highlight {
    animation: bookingPulse 2.5s ease-out;
}
@keyframes bookingPulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 151, 167, 0.6); transform: scale(1.05); }
    50% { box-shadow: 0 0 0 8px rgba(0, 151, 167, 0); }
    100% { box-shadow: var(--shadow-sm); transform: scale(1); }
}

/* Now line */
.now-line {
    position: absolute;
    left: 56px;
    right: 0;
    height: 2px;
    background: var(--now-line);
    z-index: 10;
    pointer-events: none;
}
.now-line::before {
    content: '';
    position: absolute;
    left: -5px;
    top: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--now-line);
    box-shadow: 0 0 6px rgba(217, 64, 64, 0.4);
}

/* === Live Sidebar === */
#live-sidebar {
    flex: 1;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 280px;
    max-width: 380px;
    box-shadow: var(--shadow-sm);
}
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--navy);
    background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
}
.live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-red);
    animation: livePulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes livePulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(217, 64, 64, 0.4); }
    50% { opacity: 0.6; box-shadow: 0 0 0 5px rgba(217, 64, 64, 0); }
}
.live-label {
    color: var(--accent-red);
    letter-spacing: 1.5px;
    font-size: 0.78rem;
}

/* Call status */
.call-status {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.1rem;
    background: linear-gradient(135deg, var(--teal-light) 0%, #e0f2f1 100%);
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--teal-dark);
}
.call-status.hidden { display: none; }
.call-status-icon {
    font-size: 1.1rem;
    animation: callPulse 1s ease-in-out infinite;
}
@keyframes callPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.95); }
}

/* Sidebar section label */
.sidebar-section-label {
    padding: 0.55rem 1.1rem 0.3rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
}

/* Activity list */
.activity-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.activity-list::-webkit-scrollbar { width: 5px; }
.activity-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.activity-item {
    display: flex;
    gap: 0.55rem;
    padding: 0.55rem 0.5rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.78rem;
    animation: activitySlideIn 0.35s ease-out;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.activity-item:hover {
    background: var(--teal-glow);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 1.5rem;
    text-align: center;
}
.activity-text {
    color: var(--text);
    line-height: 1.4;
    min-width: 0;
}
.activity-desc {
    font-weight: 500;
    word-break: break-word;
}
.activity-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}
@keyframes activitySlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.no-activity {
    text-align: center;
    padding: 2.5rem 1.2rem;
    color: var(--text-light);
    font-size: 0.85rem;
    line-height: 1.8;
}
.no-activity strong { color: var(--teal); }

/* === Toast Container === */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 200;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.6rem;
    pointer-events: none;
    max-width: 380px;
}
.toast {
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--teal);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.1rem;
    font-size: 0.82rem;
    color: var(--text);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    line-height: 1.45;
}
.toast.toast-booking { border-left-color: var(--accent-green); }
.toast.toast-call { border-left-color: var(--teal); }
.toast.toast-cancel { border-left-color: var(--accent-red); }
.toast.toast-out {
    animation: toastOut 0.3s ease-in forwards;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(60px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(60px); }
}

/* === Footer === */
#footer {
    border-top: 1px solid var(--border);
    background: var(--navy);
    color: rgba(255, 255, 255, 0.7);
    padding: 0;
}
.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
}
.footer-brand {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.3rem;
}
.footer-address, .footer-hours {
    font-size: 0.8rem;
    line-height: 1.6;
}
.footer-note {
    font-size: 0.72rem;
    margin-top: 0.5rem;
    opacity: 0.5;
    font-style: italic;
}
.footer-heading {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 0.75rem;
}
.footer-col {
    display: flex;
    flex-direction: column;
}
.footer-col a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.82rem;
    padding: 0.2rem 0;
    transition: color 0.15s;
}
.footer-col a:hover {
    color: var(--teal-light);
}
.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.72rem;
    text-align: center;
}
.footer-bottom a {
    color: var(--teal-light);
    text-decoration: none;
}
.footer-bottom a:hover {
    text-decoration: underline;
}

/* === Responsive === */
@media (max-width: 768px) {
    .cta-bar-inner {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
        padding: 0.6rem 1rem;
    }
    .cta-bar-left { justify-content: center; }
    .cta-bar-sub { display: none; }

    #dashboard {
        flex-direction: column;
        padding: 0.75rem;
    }
    #live-sidebar {
        max-width: none;
        max-height: 320px;
    }
    .calendar-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .calendar-grid {
        grid-template-columns: 44px repeat(var(--staff-count, 4), 1fr);
    }
    .grid-appt { font-size: 0.58rem; }
    .grid-appt .appt-treat { display: none; }
    #day-label { min-width: 160px; font-size: 0.85rem; }

    .footer-inner {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        text-align: center;
    }
}
