/*
 * scheduling.css
 * Appointment scheduling UI styles.
 * Contains: appointment grid layout, slot cards, slot details modal
 * (right-click debug view), and related scheduling components.
 */

/* ═══════════════════════════════════════════════════════════════════════════
   SCHEDULING APPOINTMENT GRID
   Responsive grid display for appointment time slots
   ═══════════════════════════════════════════════════════════════════════════ */

/* Main container */
.sop-appointments-container {
    width: 100%;
    margin: 8px 0;
}

/* Top recommendations row */
.sop-top-picks {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: linear-gradient(135deg, #f8fffe 0%, #f0f9f8 100%);
    border: 1px solid var(--hawx-teal-light);
    border-radius: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.sop-top-picks-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-600);
    padding-right: 8px;
    border-right: 1px solid var(--gray-200);
    white-space: nowrap;
}

.sop-top-picks-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

/* Hide states for appointment grid components */
.sop-appointments-container.hide,
.sop-top-picks.hide,
.sop-empty-state.hide {
    display: none;
}

/* Scrollable grid container */
.sop-appt-grid-wrapper {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: #fff;
}

.sop-appt-grid-wrapper::-webkit-scrollbar {
    width: 6px;
}

.sop-appt-grid-wrapper::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.sop-appt-grid-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Grid of days */
.sop-appt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1px;
    background: var(--gray-200);
}

/* Individual day card */
.appt-day-wrapper {
    display: flex;
    flex-direction: column;
    background: #fff;
    min-height: 90px;
}

.appt-day-wrapper:hover {
    background: var(--gray-50);
}

/* Date header within day wrapper */
.appt-day-header {
    font-weight: 600;
    font-size: 11px;
    color: var(--gray-700);
    text-align: center;
    padding: 8px 6px 6px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.appt-day-header .current-appt-icon {
    width: 14px;
    height: 14px;
    stroke: var(--info);
}

/* Slots container within day */
.appt-day-slots {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    flex: 1;
}

/* Individual appointment slot option */
.appt-option {
    position: relative;
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    text-align: center;
    font-size: 10px;
    font-weight: 500;
    color: var(--gray-600);
    background: var(--gray-50);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.appt-option:hover:not(.unavailable):not(.disabled) {
    background: var(--hawx-teal-light);
    border-color: var(--hawx-teal);
    color: var(--hawx-teal-dark);
}

.appt-option.selected {
    background: linear-gradient(135deg, var(--hawx-teal) 0%, #2f4c4a 100%);
    border-color: var(--hawx-teal-dark);
    color: #fff;
    box-shadow: 0 2px 4px rgba(99, 118, 117, 0.3);
}

.appt-option.selected:hover {
    background: linear-gradient(135deg, var(--hawx-teal-dark) 0%, #4a7a77 100%);
}

/* Unavailable slot styling */
.appt-option.unavailable,
.appt-option.disabled {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--gray-400);
    cursor: not-allowed;
    opacity: 0.6;
}

.appt-option.unavailable::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 1px;
    background: var(--gray-400);
    transform: rotate(-10deg);
}

/* Time label within option */
.appt-option-time {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 10px;
    line-height: 1.2;
}

/* Medal icons for top 3 options */
.medal-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.appt-option .medal-wrapper {
    position: absolute;
    top: -8px;
    right: -4px;
}

.appt-option .medal-wrapper .medal-icon {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

/* No preference styling - slightly different look */
.appt-option.no-preference {
    background: var(--gray-50);
    border-style: dashed;
}

.appt-option.no-preference:hover:not(.unavailable):not(.disabled) {
    background: var(--hawx-teal-light);
    border-style: solid;
}

.appt-option.no-preference.selected {
    background: linear-gradient(135deg, var(--hawx-teal) 0%, #2f4c4a 100%);
    border-style: solid;
}

/* Top pick appointment chip */
.appt-top-pick {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.15s;
}

.appt-top-pick:hover:not(.unavailable) {
    border-color: var(--hawx-teal);
    background: var(--hawx-teal-light);
}

.appt-top-pick.selected {
    background: var(--hawx-teal);
    border-color: var(--hawx-teal-dark);
    color: #fff;
}

.appt-top-pick .medal-icon {
    width: 16px;
    height: 16px;
}

.appt-top-pick-date {
    font-weight: 600;
}

.appt-top-pick-time {
    color: var(--gray-500);
    font-size: 10px;
}

.appt-top-pick.selected .appt-top-pick-time {
    color: rgba(255,255,255,0.8);
}

/* Grid info bar */
.sop-grid-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    font-size: 11px;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.sop-grid-count {
    font-weight: 500;
}

/* Empty state for no appointments */
.sop-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    color: var(--gray-400);
    text-align: center;
}

.sop-empty-state svg {
    stroke: var(--gray-300);
}

/* Loading state */
.sop-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    color: var(--gray-500);
    font-size: 11px;
}

.progress-bar-container {
    width: 200px;
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--hawx-teal) 0%, var(--hawx-gold) 100%);
    width: 0%;
    transition: width 0.3s ease-out;
    animation: progress-indeterminate 1.5s infinite;
}

@keyframes progress-indeterminate {
    0% {
        width: 0%;
        margin-left: 0%;
    }
    50% {
        width: 50%;
        margin-left: 25%;
    }
    100% {
        width: 0%;
        margin-left: 100%;
    }
}

/* Calendar icon for current appointment marker */
.current-appt-icon {
    width: 12px;
    height: 12px;
    stroke: var(--info);
    flex-shrink: 0;
}

.appt-option.selected .current-appt-icon {
    stroke: #fff;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCHEDULING SLOT DETAILS MODAL (Right-click debug view)
   ═══════════════════════════════════════════════════════════════════════════ */
.slot-details-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.slot-details-modal-overlay.hide {
    display: none;
}

.slot-details-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    width: 450px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.slot-details-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--hawx-teal);
    color: #fff;
}

.slot-details-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.slot-details-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.15s;
}

.slot-details-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.slot-details-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.slot-responses-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.slot-response {
    border-radius: 8px;
    border: 1px solid;
    margin-bottom:8px;
}

.slot-response.success {
    border-color: #86efac;
}

.slot-response.error {
    border-color: #fca5a5;
}

.slot-response .response-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.slot-response.success .response-header {
    background: #f0fdf4;
    border-color: #86efac;
}

.slot-response.error .response-header {
    background: #fef2f2;
    border-color: #fca5a5;
}

.response-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.response-badge.success {
    background: #22c55e;
    color: #fff;
}

.response-badge.error {
    background: #ef4444;
    color: #fff;
}

.response-badge.d2d {
    background: #3b82f6;
    color: #fff;
    margin-left: 8px;
}

.route-id {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 500;
}

.response-body {
    padding: 10px 12px;
    background: #fff;
    border-radius: 8px;
}

.response-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 12px;
}

.response-row:not(:last-child) {
    border-bottom: 1px dashed var(--gray-100);
}

.response-label {
    color: var(--gray-500);
}

.response-value {
    font-weight: 500;
    color: var(--gray-700);
    margin-left: 8px;
}

.response-row.error-reason .response-value {
    color: #ef4444;
}

.slot-details-footer {
    padding: 12px 20px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
}

.slot-details-close-btn {
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid var(--gray-300);
    background: #fff;
    color: var(--gray-700);
}

.slot-details-close-btn:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}


