/**
 * DPC Search Autocomplete - Retro Medical Modern Theme
 * Swiss International Style: square corners, rules not shadows, Inter font
 */

/* ============================================================================
   CSS Custom Properties - Retro Medical Integration
   ========================================================================== */

:root {
    /* Semantic Colors - Type-Specific (retro warm palette) */
    --dpc-practice: #1A1A1A;  /* Ink black */
    --dpc-practice-bg: #F0E6DA;  /* Sand */

    --dpc-physician: #1A1A1A;  /* Ink black */
    --dpc-physician-bg: #FAF7F2;  /* Cream */

    --dpc-location: #4A4A4A;  /* Charcoal */
    --dpc-location-bg: #F0E6DA;  /* Sand */

    --dpc-specialty: #C2552D;  /* Rust orange */
    --dpc-specialty-bg: rgba(194, 85, 45, 0.08);  /* Rust tint */

    /* Spacing Scale */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 20px;
}

/* ============================================================================
   Main Container - Architectural Card
   ========================================================================== */

.dpc-search-dropdown {
    position: relative;
    max-width: 100%;
    border-radius: 0;
    background: #FFFFFF;
    border: 2px solid #D4D0CB;
    box-shadow: none;
    overflow: hidden;
    margin-top: var(--space-sm);
    animation: slideInDown 200ms ease-out;
    text-align: left;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   Result Groups - Sectioned Hierarchy
   ========================================================================== */

.result-group {
    position: relative;
}

.result-group:not(:last-child) {
    border-bottom: 1px solid #D4D0CB;
}

.result-group-header {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 10px var(--space-lg);
    background: #FAF7F2;
    border-bottom: 2px solid #C2552D;  /* Rust accent */
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #C2552D;
    animation: fadeIn 200ms ease-out backwards;
}

/* Stagger group header animations */
.result-group:nth-child(1) .result-group-header { animation-delay: 30ms; }
.result-group:nth-child(2) .result-group-header { animation-delay: 60ms; }
.result-group:nth-child(3) .result-group-header { animation-delay: 90ms; }
.result-group:nth-child(4) .result-group-header { animation-delay: 120ms; }

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================================================
   Result Items - Scannable Rows
   ========================================================================== */

.result-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 12px var(--space-lg);
    background: #FFFFFF;
    border-left: 3px solid transparent;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.result-item:not(:last-child) {
    border-bottom: 1px solid rgba(212, 208, 203, 0.5);
}

.result-item:hover {
    background: #FAF7F2;
    border-left-color: #C2552D;
    text-decoration: none;
    transform: none;
}

.result-item:active {
    background: #F0E6DA;
}

.result-item.keyboard-focus,
.result-item:focus-visible {
    background: #FAF7F2;
    outline: 2px solid #C2552D;
    outline-offset: -2px;
    border-left-color: #C2552D;
}

.result-content {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

/* ============================================================================
   Icon Badges - Square Indicators
   ========================================================================== */

.icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 0;
    flex-shrink: 0;
    font-size: 15px;
    border: 1px solid #D4D0CB;
}

.result-item:hover .icon-badge {
    border-color: #C2552D;
}

/* ============================================================================
   Result Text - Swiss Typography
   ========================================================================== */

.result-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.result-name {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: #1A1A1A;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.result-metadata {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    color: #4A4A4A;
    opacity: 0.8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================================
   Type-Specific Styling
   ========================================================================== */

/* Practices */
.result-item.practice .icon-badge {
    background: var(--dpc-practice-bg);
    color: var(--dpc-practice);
}

.result-item.practice:hover {
    border-left-color: var(--dpc-practice);
}

/* Physicians */
.result-item.physician .icon-badge {
    background: var(--dpc-physician-bg);
    color: var(--dpc-physician);
}

.result-item.physician:hover {
    border-left-color: #C2552D;
}

/* Locations */
.result-item.location .icon-badge {
    background: var(--dpc-location-bg);
    color: var(--dpc-location);
}

.result-item.location:hover {
    border-left-color: var(--dpc-location);
}

/* Specialties */
.result-item.specialty .icon-badge {
    background: var(--dpc-specialty-bg);
    color: var(--dpc-specialty);
}

.result-item.specialty:hover {
    border-left-color: var(--dpc-specialty);
}

/* ============================================================================
   Empty State
   ========================================================================== */

.dpc-search-dropdown.empty-state {
    padding: 48px 32px;
    text-align: center;
    background: #FFFFFF;
    border: 2px solid #D4D0CB;
}

.empty-state-content {
    max-width: 320px;
    margin: 0 auto;
}

.empty-state-icon {
    font-size: 36px;
    color: #D4D0CB;
    margin-bottom: var(--space-lg);
}

.empty-state-title {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #1A1A1A;
    margin: 0 0 var(--space-sm) 0;
    letter-spacing: -0.01em;
}

.empty-state-description {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.6;
    color: #4A4A4A;
    opacity: 0.8;
    margin: 0;
}

/* ============================================================================
   Loading Skeleton
   ========================================================================== */

.dpc-search-dropdown.loading-skeleton {
    padding: var(--space-sm);
}

.skeleton-group {
    margin-bottom: var(--space-md);
}

.skeleton-group:last-child {
    margin-bottom: 0;
}

.skeleton-header {
    height: 32px;
    background: linear-gradient(90deg, #F0E6DA 0%, #D4D0CB 50%, #F0E6DA 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite linear;
    margin-bottom: var(--space-xs);
}

.skeleton-item {
    display: flex;
    align-items: center;
    padding: 12px var(--space-lg);
    gap: 12px;
    margin-bottom: var(--space-xs);
}

.skeleton-item:last-child {
    margin-bottom: 0;
}

.skeleton-icon {
    width: 32px;
    height: 32px;
    border-radius: 0;
    background: linear-gradient(90deg, #F0E6DA 0%, #D4D0CB 50%, #F0E6DA 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite linear;
    flex-shrink: 0;
}

.skeleton-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skeleton-line {
    height: 14px;
    background: linear-gradient(90deg, #F0E6DA 0%, #D4D0CB 50%, #F0E6DA 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite linear;
}

.skeleton-line.primary {
    width: 70%;
}

.skeleton-line.secondary {
    width: 50%;
    height: 12px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .dpc-search-dropdown {
        margin-top: 6px;
    }

    .result-item {
        padding: 10px 14px;
    }

    .result-group-header {
        padding: 8px 14px;
        font-size: 9px;
    }

    .icon-badge {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .result-name {
        font-size: 13px;
    }

    .result-metadata {
        font-size: 11px;
    }
}

@media (max-width: 576px) {
    .result-content {
        gap: 10px;
    }

    .icon-badge {
        width: 26px;
        height: 26px;
        font-size: 13px;
    }

    .empty-state-icon {
        font-size: 28px;
    }

    .dpc-search-dropdown.empty-state {
        padding: 36px 24px;
    }
}

/* ============================================================================
   Accessibility
   ========================================================================== */

@media (prefers-contrast: high) {
    .result-item {
        border: 1px solid #1A1A1A;
        border-left-width: 3px;
    }

    .result-item.keyboard-focus {
        outline-width: 3px;
        outline-offset: -3px;
    }

    .result-group-header {
        border-bottom-width: 3px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dpc-search-dropdown,
    .result-group-header,
    .result-item,
    .icon-badge {
        animation: none;
        transition: none;
    }
}

@media print {
    .dpc-search-dropdown {
        display: none;
    }
}
