/* CSS Reset - match Tailwind/React app */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Hide page title element */
pagetitle {
    display: none !important;
}

/* Hide default Blazor error banner */
#blazor-error-ui {
    display: none !important;
}

/* Scheduler container - align with React root (h-screen w-screen overflow-hidden bg-white) */
.scheduler-container {
    width: 100vw !important;
    height: 100vh !important;
    overflow: hidden !important;
    background: #ffffff !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Grid container hierarchy for proper scrolling */
.scheduler-grid-container {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    min-height: 0 !important;
}

.grid-wrapper {
    flex: 1 !important;
    overflow: auto !important;
    background: #F9FAFB !important;
    min-height: 0 !important;
}

.scheduler-grid {
    display: grid !important;
    min-width: min-content !important;
    /* Match header (50px) and body rows (60px) to remove vertical gaps */
    grid-template-rows: 60px;
    grid-auto-rows: 60px !important;
}

/* Header parity - match React: h-[60px] px-6 bg-white border-b border-gray-200 */
.scheduler-header {
    height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 24px !important;  /* px-6 = 24px */
    background: white !important;
    border-bottom: 1px solid #E5E7EB !important;  /* border-gray-200 */
}

/* Header navigation (left section) - match React: flex items-center gap-3 */
.header-nav {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;  /* gap-3 = 12px */
}

/* Navigation buttons - match React: h-9 w-9 */
.nav-button {
    height: 36px !important;  /* h-9 = 36px */
    width: 36px !important;   /* w-9 = 36px */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    transition: background-color 0.15s ease-in-out !important;
}

.nav-button:hover {
    background-color: #F3F4F6 !important;  /* hover:bg-gray-100 */
}

.nav-icon {
    width: 20px !important;  /* w-5 = 20px */
    height: 20px !important; /* h-5 = 20px */
    color: #374151 !important;  /* text-gray-700 */
}

/* Today button - match React: px-2 py-1.5 font-medium */
.today-button {
    padding: 6px 8px !important;  /* px-2 py-1.5 */
    border-radius: 6px !important;
    border: none !important;
    background: transparent !important;
    font-weight: 500 !important;  /* font-medium */
    color: #111827 !important;  /* text-gray-900 */
    cursor: pointer !important;
    transition: background-color 0.15s ease-in-out !important;
}

.today-button:hover {
    background-color: #F3F4F6 !important;
}

/* Date separator - match React: text-gray-400 */
.date-separator {
    color: #9CA3AF !important;  /* text-gray-400 */
}

/* Date button - match React: px-2 py-1.5 */
.date-button {
    padding: 6px 8px !important;
    border-radius: 6px !important;
    border: none !important;
    background: transparent !important;
    color: #111827 !important;
    cursor: pointer !important;
    transition: background-color 0.15s ease-in-out !important;
}

.date-button:hover {
    background-color: #F3F4F6 !important;
}

.dentist-scope-label {
    color: #6B7280 !important;
    font-size: 13px !important;
}

.dentist-scope-select {
    height: 34px !important;
    border: 1px solid #D1D5DB !important;
    border-radius: 6px !important;
    background: white !important;
    color: #111827 !important;
    font-size: 13px !important;
    padding: 4px 8px !important;
}

.dentist-scope-select:focus {
    outline: none !important;
    border-color: #3B82F6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12) !important;
}

/* Header user section (right) - match React: flex items-center gap-3 */
.header-user {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

/* Dark mode button - match React: h-9 w-9 */
.dark-mode-button {
    height: 36px !important;
    width: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    transition: background-color 0.15s ease-in-out !important;
}

.dark-mode-button:hover {
    background-color: #F3F4F6 !important;
}

.dark-mode-icon {
    width: 20px !important;
    height: 20px !important;
    color: #374151 !important;
}

/* User badge - match React: flex items-center gap-2 */
.user-badge {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;  /* gap-2 = 8px */
}

/* User icon container - match React: h-8 w-8 rounded-full bg-gray-200 */
.user-badge svg.user-icon {
    width: 32px !important;   /* h-8 = 32px */
    height: 32px !important;
    padding: 8px !important;
    border-radius: 50% !important;
    background-color: #E5E7EB !important;  /* bg-gray-200 */
    color: #4B5563 !important;  /* text-gray-600 */
}

/* User role text - match React: font-medium text-gray-900 */
.user-role {
    font-weight: 500 !important;
    color: #111827 !important;
}

/* Grid header cells */
.grid-header {
    height: 50px !important;
    padding: 12px 16px !important;
    border-bottom: 2px solid #E5E7EB !important;
    background: white !important;
    font-weight: 600 !important;
    text-align: center !important;
}

/* Available cell - softer plus and border */
.available-cell {
    border: 1px solid #10B981 !important;
    border-radius: 4px !important;
    font-size: 28px !important;
}

/* Unavailable cell - hatch pattern */
.unavailable-cell {
    border-radius: 4px !important;
    background: repeating-linear-gradient(
        135deg,
        #F3F4F6 0,
        #F3F4F6 12px,
        #E5E7EB 12px,
        #E5E7EB 24px
    ) !important;
}

/* Time cell styling */
.time-cell {
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
}

button.available-cell {
    background: #D1FAE5 !important;
    border: 1px solid #10B981 !important;
    border-radius: 4px !important;
}

button.available-cell:hover {
    background: #A7F3D0 !important;
    border-color: #059669 !important;
    transform: scale(1.02) !important;
}

.unavailable-cell {
    background: #F3F4F6 !important;
    border: 1px solid #E5E7EB !important;
}

/* ============= APPOINTMENT CARD STYLES ============= */
.appointment-card {
    background: white !important;
    border: 1px solid #BFDBFE !important; /* clearer edge */
    border-left: 4px solid #2563EB !important; /* stronger accent */
    border-radius: 6px !important;
    border-top: none !important;
    padding: 8px 12px !important;
    cursor: pointer !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    transition: all 0.18s ease !important;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.05) !important;
}

.appointment-card:hover {
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.15) !important;
    transform: translateY(-2px) scale(1.01) !important;
    z-index: 8 !important;
}

.card-content {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
}

.patient-name {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #111827 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.appointment-reason {
    font-size: 12px !important;
    color: #6B7280 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.status-badge {
    display: inline-block !important;
    padding: 2px 8px !important;
    border-radius: 12px !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    width: fit-content !important;
}

/* Status Card Colors */
.status-planned {
    background: #DBEAFE !important;
    border-left-color: #3B82F6 !important;
}

.status-arrived {
    background: #FEF08A !important;
    border-left-color: #F59E0B !important;
}

.status-inchair {
    background: #DDD6FE !important;
    border-left-color: #8B5CF6 !important;
}

.status-completed {
    background: #DCFCE7 !important;
    border-left-color: #10B981 !important;
}

.status-cancelled {
    background: #FEE2E2 !important;
    border-left-color: #EF4444 !important;
}

.status-noshow {
    background: #F3F4F6 !important;
    border-left-color: #9CA3AF !important;
}

/* Status Badge Colors */
.badge-planned {
    background: #DBEAFE !important;
    color: #1E40AF !important;
}

.badge-arrived {
    background: #FEF3C7 !important;
    color: #92400E !important;
}

.badge-inchair {
    background: #EDE9FE !important;
    color: #6B21A8 !important;
}

.badge-completed {
    background: #D1FAE5 !important;
    color: #065F46 !important;
}

.badge-cancelled {
    background: #FEE2E2 !important;
    color: #991B1B !important;
}

.badge-noshow {
    background: #F3F4F6 !important;
    color: #4B5563 !important;
}

/* ============= MODAL BUTTON STYLES ============= */
.btn {
    padding: 10px 20px !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    border: none !important;
}

.btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

.btn-primary {
    background: #3B82F6 !important;
    color: white !important;
}

.btn-primary:hover:not(:disabled) {
    background: #2563EB !important;
}

.btn-secondary {
    background: white !important;
    color: #374151 !important;
    border: 1px solid #D1D5DB !important;
}

.btn-secondary:hover {
    background: #F3F4F6 !important;
}

.create-patient-button {
    width: 100% !important;
    padding: 12px !important;
    background: white !important;
    border: 2px dashed #D1D5DB !important;
    border-radius: 6px !important;
    color: #3B82F6 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    margin-bottom: 16px !important;
}

.create-patient-button:hover {
    background: #F9FAFB !important;
    border-color: #3B82F6 !important;
}

.selected-patient-display {
    padding: 12px !important;
    background: #D1FAE5 !important;
    border-left: 3px solid #10B981 !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    color: #065F46 !important;
    margin-bottom: 16px !important;
}

.register-button {
    background: #10B981 !important;
}

.register-button:hover:not(:disabled) {
    background: #059669 !important;
}


/* ============= MODAL OVERLAY & CONTENT ============= */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 999 !important;
}

.modal-content {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: white !important;
    border-radius: 10px !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    padding: 24px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    z-index: 1000 !important;
    width: 480px !important;
    max-width: 90vw !important;
}

/* Wide modal for complex forms (Visit Modal) */
.modal-content-wide {
    width: 90% !important;
    max-width: 1400px !important;
}

.modal-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 20px !important;
}

.modal-header h2 {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #111827 !important;
    margin: 0 !important;
}

.close-button {
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    background: transparent !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 24px !important;
    color: #6B7280 !important;
    transition: background 0.2s !important;
}

.close-button:hover {
    background: #F3F4F6 !important;
}

.locked-info {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    margin-bottom: 20px !important;
}

.info-row {
    background: #F9FAFB !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
}

.info-row .label {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #374151 !important;
}

.info-row .value {
    font-size: 14px !important;
    color: #111827 !important;
}

.form-group {
    margin-bottom: 16px !important;
}

.form-group label {
    display: block !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #374151 !important;
    margin-bottom: 6px !important;
}

.search-input-wrapper {
    position: relative !important;
}

.search-icon {
    position: absolute !important;
    left: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 16px !important;
    height: 16px !important;
    color: #9CA3AF !important;
    pointer-events: none !important;
}

.form-control {
    width: 100% !important;
    height: 40px !important;
    padding: 8px 12px !important;
    border: 1px solid #D1D5DB !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    transition: all 0.2s !important;
}

.search-input-wrapper .form-control {
    padding-left: 40px !important;
}

.form-control:focus {
    outline: none !important;
    border-color: #3B82F6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

textarea.form-control {
    height: auto !important;
    resize: vertical !important;
    min-height: 80px !important;
}

.search-loading {
    padding: 12px !important;
    text-align: center !important;
    color: #6B7280 !important;
    font-size: 14px !important;
}

.search-results {
    border: 1px solid #E5E7EB !important;
    border-radius: 6px !important;
    max-height: 200px !important;
    overflow-y: auto !important;
    margin-bottom: 16px !important;
}

.search-result-item {
    padding: 12px !important;
    border-bottom: 1px solid #F3F4F6 !important;
    cursor: pointer !important;
    transition: background 0.2s !important;
}

.search-result-item:last-child {
    border-bottom: none !important;
}

.search-result-item:hover {
    background: #F9FAFB !important;
}

.search-result-item.selected {
    background: #EFF6FF !important;
}

.patient-name-search {
    font-size: 14px !important;
    color: #111827 !important;
    margin-bottom: 4px !important;
}

.patient-details-search {
    font-size: 12px !important;
    color: #6B7280 !important;
}

.no-results {
    padding: 16px !important;
    text-align: center !important;
    color: #6B7280 !important;
    font-size: 14px !important;
}

.error-message {
    padding: 12px !important;
    background: #FEF2F2 !important;
    border: 1px solid #FCA5A5 !important;
    border-radius: 6px !important;
    color: #DC2626 !important;
    font-size: 14px !important;
    margin-bottom: 16px !important;
}

.modal-footer {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 12px !important;
    margin-top: 24px !important;
}

/* ============= DATE PICKER MODAL ============= */
.datepicker-modal {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: white !important;
    border-radius: 12px !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    padding: 0 !important;
    z-index: 1000 !important;
    width: 320px !important;
    max-width: 90vw !important;
}

.datepicker-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 16px 20px !important;
    border-bottom: 1px solid #E5E7EB !important;
}

.datepicker-title {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #111827 !important;
    margin: 0 !important;
}

.datepicker-nav {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 12px 20px !important;
}

.datepicker-nav-button {
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    background: transparent !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    color: #374151 !important;
    transition: background-color 0.15s !important;
}

.datepicker-nav-button:hover {
    background-color: #F3F4F6 !important;
}

.datepicker-nav-button svg {
    width: 20px !important;
    height: 20px !important;
}

.datepicker-month {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #111827 !important;
}

.datepicker-days-header {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    padding: 8px 20px !important;
    border-bottom: 1px solid #F3F4F6 !important;
}

.datepicker-day-name {
    text-align: center !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #6B7280 !important;
    padding: 4px 0 !important;
}

.datepicker-calendar {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    padding: 12px 20px 20px !important;
    gap: 4px !important;
}

.datepicker-day {
    aspect-ratio: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    background: transparent !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    color: #111827 !important;
    transition: all 0.15s !important;
}

.datepicker-day:hover {
    background-color: #F3F4F6 !important;
}

.datepicker-day.selected {
    background-color: #3B82F6 !important;
    color: white !important;
    font-weight: 600 !important;
}

.datepicker-day.today {
    background-color: #DBEAFE !important;
    color: #1E40AF !important;
    font-weight: 600 !important;
}

.datepicker-day.selected.today {
    background-color: #2563EB !important;
    color: white !important;
}

.datepicker-day-empty {
    aspect-ratio: 1 !important;
}

/* ===== SCHEDULER STICKY HEADERS FIX ===== */
.scheduler-grid-container {
    height: calc(100vh - 60px) !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
    position: relative !important;
    background: #E5E7EB !important;
}

.scheduler-grid {
    display: grid !important;
    gap: 1px !important;
    background: #E5E7EB !important;
}

.grid-header {
    position: sticky !important;
    top: 0 !important;
    background: white !important;
    z-index: 10 !important;
    height: 50px !important;
    border-bottom: 2px solid #E5E7EB !important;
}

.time-header {
    position: sticky !important;
    left: 0 !important;
    z-index: 20 !important;
    background: #F9FAFB !important;
}

.time-cell {
    position: sticky !important;
    left: 0 !important;
    z-index: 10 !important;
    background: #F9FAFB !important;
    border-right: 2px solid #D1D5DB !important;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 300px;
    padding: 12px 16px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    animation: slideIn 0.3s ease;
}

.toast button {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 0 0 0 12px;
    color: inherit;
    opacity: 0.7;
}

.toast button:hover {
    opacity: 1;
}

.toast-success {
    background: #10B981;
    color: white;
}

.toast-error {
    background: #EF4444;
    color: white;
}

.toast-warning {
    background: #F59E0B;
    color: white;
}

.toast-info {
    background: #3B82F6;
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Confirmation Dialog */
.confirmation-dialog {
    background: white;
    padding: 24px;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index: 1001;
}

.confirmation-dialog h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: #111827;
}

.confirmation-dialog p {
    margin: 0 0 8px 0;
    color: #6B7280;
}

.confirmation-dialog .patient-info {
    margin-bottom: 20px;
    color: #111827;
}

.dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Confirmation Dialog Overlay */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

/* Confirmation Dialog */
.confirmation-dialog {
    background: white;
    padding: 24px;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    z-index: 1002;
}
/* Loading Spinner */
.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3B82F6;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 0.8s linear infinite;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* Duration Dropdown Styling */
.duration-select {
    padding: 8px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    min-width: 150px;
}

.duration-select:hover {
    border-color: #3B82F6;
}

.duration-select:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Blocked continuation cell */
.blocked-cell {
    height: 100% !important;
    background: #F3F4F6;
    border: 1px solid #D1D5DB;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9CA3AF;
    font-size: 12px;
    pointer-events: none;
}

/* Uniform heights for all grid cells */
.appointment-card,
.available-cell,
.unavailable-cell,
.time-cell {
    height: 100% !important;
}
