/* SEARCH BOX                                 */
/* Global search input, clear button,         */
/* search results dropdown, result cards.     */

.search-wrapper {
    position: relative;
    max-width: 300px;
    min-width: 200px;
    flex: 1;
    z-index: 10;
    overflow: visible;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 22px;
    height: 38px;
    padding: 0 0.75rem;
    transition: all 0.2s;
    width: 100%;
}

.search-box > .fa-search {
    color: #9ca3af;
    margin-right: 8px;
    font-size: 15px;
}

.search-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 15px;
    flex: 1;
    min-width: 0;
    width: 100%;
    font-weight: 400;
    text-overflow: ellipsis;
}

.search-input::placeholder {
    color: #9ca3af;
    text-overflow: ellipsis;
}

.search-clear {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.search-clear:hover {
    color: #374151;
    transform: scale(1.1);
}

/* Search Filter Dropdown (Dribbble-style) */
.search-filter-divider {
    width: 1px;
    height: 18px;
    background: #d1d5db;
    margin: 0 2px 0 4px;
    flex-shrink: 0;
}

.search-filter-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    border-radius: 6px;
    transition: background 0.15s;
    width: 100px;
    flex-shrink: 0;
}

.search-filter-toggle:hover {
    background: #f3f4f6;
}

.search-filter-toggle i {
    font-size: 9px;
    color: #9ca3af;
    transition: transform 0.2s;
}

.search-filter-toggle.open i {
    transform: rotate(180deg);
}

.search-filter-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 190px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 20001;
    padding: 5px;
    animation: fadeIn 0.15s ease;
}

.search-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 10px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
}

.search-filter-option:hover {
    background: #f3f4f6;
}

.search-filter-option.active {
    color: #1d4ed8;
    font-weight: 600;
}

.search-filter-option i {
    width: 16px;
    text-align: center;
    font-size: 13px;
    color: #9ca3af;
}

.search-filter-option.active i {
    color: #1d4ed8;
}

.search-filter-heading {
    font-size: 10px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 10px 3px;
    border-top: 1px solid #f3f4f6;
    margin-top: 2px;
}

.search-filter-heading:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 4px;
}

/* Search Results */
.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 450px;
    overflow-y: auto;
    z-index: 20000;
    display: none;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Result Cards */
.search-result-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f3f4f6;
    position: relative;
}

.search-result-card:last-child {
    border-bottom: none;
}

.search-result-card:hover {
    background: #f9fafb;
    transform: translateX(2px);
}

.result-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.result-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.result-main {
    flex: 1;
    min-width: 0;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.result-title {
    font-weight: 600;
    font-size: 15px;
    color: #111827;
}

.result-badge {
    font-size: 11px;
    padding: 2px 8px;
    background: #f3f4f6;
    border-radius: 10px;
    font-weight: 600;
    color: #6b7280;
    flex-shrink: 0;
}

.result-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 4px;
    font-size: 13px;
    color: #6b7280;
}

.result-details span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.result-details i {
    font-size: 11px;
    opacity: 0.7;
}

.result-meta {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

.result-provider {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

.result-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.result-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #f3f4f6;
    border: none;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 13px;
}

.result-action-btn:hover {
    background: #10b981;
    color: white;
    transform: scale(1.05);
}

/* Status Pills */
.status-pill {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-scheduled {
    background: #dbeafe;
    color: #1e40af;
}

.status-arrived {
    background: #ede9fe;
    color: #6b21a8;
}

.status-ready {
    background: #fef3c7;
    color: #92400e;
}

.status-in-treatment {
    background: #ddd6fe;
    color: #5b21b6;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

/* Appointment-specific */
.search-result-appointment .result-details {
    font-size: 12px;
}

/* Patient-specific */
.search-result-patient .result-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

/* Queue-specific */
.search-result-queue .result-icon {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.search-result-queue.urgency-medium {
    border-left: 3px solid #f59e0b;
}

.search-result-queue.urgency-high {
    border-left: 3px solid #ef4444;
    background: #fef2f2;
}

/* Follow-up-specific */
.search-result-followup .result-icon {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.search-result-followup .due-date {
    font-weight: 600;
    color: #059669;
}

.search-result-followup.followup-overdue {
    border-left: 3px solid #ef4444;
    background: #fef2f2;
}

.search-result-followup.followup-overdue .due-date {
    color: #dc2626;
}

.search-no-results {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: #9ca3af;
}

.search-no-results i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.4;
    display: block;
}

.search-no-results p {
    font-size: 15px;
    font-weight: 500;
    margin: 8px 0 4px 0;
    color: #6b7280;
}

.search-no-results small {
    font-size: 13px;
    color: #9ca3af;
}

.search-more {
    padding: 12px 1rem;
    text-align: center;
    color: #10b981;
    font-size: 13px;
    background: #f0fdf4;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* SEARCH HISTORY                             */
/* Recent searches with clear buttons         */

.search-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    font-size: 13px;
    font-weight: 600;
    color: #495057;
}

.search-history-header i {
    color: var(--calendar-green);
    margin-right: 8px;
}

.history-clear-all {
    background: none;
    border: 1px solid #dc3545;
    color: #dc3545;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.history-clear-all:hover {
    background: #dc3545;
    color: white;
}

.search-history-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f1f3f4;
}

.search-history-item:hover {
    background: #f8f9fa;
}

.search-history-item:last-child {
    border-bottom: none;
}

.history-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: var(--calendar-green);
    font-size: 12px;
}

.history-main {
    flex: 1;
}

.history-title {
    font-size: 14px;
    color: #495057;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-badge {
    font-size: 12px;
}

.history-subtitle {
    font-size: 12px;
    color: #6c757d;
    margin-top: 2px;
}

.history-clear-item {
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    font-size: 12px;
    opacity: 0;
}

.search-history-item:hover .history-clear-item {
    opacity: 1;
}

.history-clear-item:hover {
    background: #e9ecef;
    color: #dc3545;
}

.history-action-btn {
    width: 28px;
    height: 28px;
    background: #f3f4f6;
    border: none;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 12px;
    opacity: 0;
    margin-right: 6px;
}

.search-history-item:hover .history-action-btn {
    opacity: 1;
}

.history-action-btn:hover {
    background: #10b981;
    color: white;
    transform: scale(1.05);
}

/* Result icon color variants */
.result-icon-amber    { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.result-icon-purple   { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }
.result-icon-green    { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.result-icon-indigo   { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); }

/* Result badge status variants */
.result-badge-paid    { background: #d1fae5; color: #065f46; }

/* Result detail color accents */
.result-text-purple   { color: #8b5cf6; }
.result-text-green    { color: #16a34a; }
.result-text-red      { color: #dc2626; }
.result-meta-sub      { font-size: 11px; color: #6b7280; margin-top: 2px; }