/* Search Page Styles - Full-text transmission search */

/* ========================================
   Search Bar Component
   ======================================== */

.search-bar {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    font-size: 1.25rem;
    color: #999;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #ad1a23;
}

.search-input::placeholder {
    color: #999;
}

.search-clear-btn {
    position: absolute;
    right: 0.5rem;
    background: #f8f9fa;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.25rem;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.search-clear-btn:hover {
    background: #e9ecef;
    color: #333;
    transform: scale(1.1);
}

/* ========================================
   Search Filters Component
   ======================================== */

.search-filters {
    background: white;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.search-filters-header {
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    user-select: none;
    transition: background-color 0.2s;
}

.search-filters-header:hover {
    background: #e9ecef;
}

.filters-active-badge {
    color: #ad1a23;
    font-weight: 600;
}

.section-toggle {
    color: #666;
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.search-filters.collapsed .section-toggle {
    transform: rotate(-90deg);
}

.search-filters.collapsed .search-filters-content {
    display: none;
}

.search-filters-content {
    padding: 1rem;
}

.filter-group {
    margin-bottom: 1rem;
}

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

.filter-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.selected-count {
    color: #ad1a23;
    font-weight: 500;
}

/* Date Range Inputs */
.date-range-inputs {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.date-input-wrapper {
    flex: 1;
    min-width: 180px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-label {
    font-size: 0.85rem;
    color: #666;
    white-space: nowrap;
}

.date-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.date-input:focus {
    outline: none;
    border-color: #ad1a23;
}

/* Department Checkboxes */
.department-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.department-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.department-checkbox-label:hover {
    background: #e9ecef;
}

.department-checkbox {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #ad1a23;
}

.department-name {
    font-size: 0.9rem;
    color: #333;
    user-select: none;
}

/* Filter Actions */
.filter-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
}

.clear-filters-btn {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-filters-btn:hover {
    background: #e9ecef;
    border-color: #999;
    color: #333;
}

/* ========================================
   Search Results Bar
   ======================================== */

.search-results-bar {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    text-align: center;
}

.search-results-text {
    font-size: 0.95rem;
    color: #666;
}

.search-results-count {
    font-weight: 600;
    color: #ad1a23;
}

.search-updating {
    font-style: italic;
    color: #999;
}

/* ========================================
   Search Results List
   ======================================== */

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ========================================
   Search Result Card Component
   ======================================== */

.search-result-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.search-result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.search-result-card.priority-card {
    border-left: 6px solid #dc3545;
    background-color: #fff5f5;
}

.search-result-card.routine-card {
    border-left: 6px solid #6c757d;
}

/* Date Badge (for cross-day results) */
.date-badge {
    display: inline-block;
    background: #ad1a23;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

/* Search Snippet with Highlighted Text */
.search-snippet {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #ad1a23;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #555;
}

.search-highlight {
    background-color: #fff3cd;
    color: #856404;
    font-weight: 600;
    padding: 2px 4px;
    border-radius: 3px;
}

/* ========================================
   Loading & Error States
   ======================================== */

.search-loading {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.search-loading .loading-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    animation: loading-pulse 1.5s ease-in-out infinite;
}

@keyframes loading-pulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

.search-error {
    text-align: center;
    padding: 2rem 1rem;
    background: #fff5f5;
    border-radius: 8px;
    border: 1px solid #f8d7da;
}

.search-error .error-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.7;
}

.search-error h3 {
    color: #721c24;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.search-error .error-text {
    color: #721c24;
    font-weight: 500;
    margin-bottom: 1rem;
}

.search-error .error-actions {
    margin: 1rem 0;
}

.search-error .error-hint {
    color: #856404;
    font-style: italic;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.retry-btn {
    background: #ad1a23;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.65rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.retry-btn:hover {
    background: #8d1519;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.retry-btn:active {
    transform: translateY(0);
}

/* Info Message (for warnings, hints, non-error states) */
.search-info-message {
    text-align: center;
    padding: 2rem 1rem;
    background: #e7f3ff;
    border-radius: 8px;
    border: 1px solid #b3d9ff;
}

.search-info-message .info-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.7;
}

.search-info-message h3 {
    color: #004085;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.search-info-message p {
    color: #004085;
    margin-bottom: 0.5rem;
}

.search-info-message .info-hint {
    color: #0c5460;
    font-style: italic;
    font-size: 0.9rem;
    margin-top: 0.75rem;
}

/* ========================================
   Empty States
   ======================================== */

.search-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.search-empty-state h3 {
    color: #2c3e50;
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
}

.search-empty-state p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    color: #666;
}

.search-empty-state strong {
    color: #ad1a23;
}

/* Search Tips / Suggestions */
.search-tips,
.search-suggestions {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: left;
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

.search-tips h4,
.search-suggestions h4 {
    color: #2c3e50;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.search-tips ul,
.search-suggestions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-tips li,
.search-suggestions li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: #555;
}

.search-tips li::before,
.search-suggestions li::before {
    content: '💡';
    position: absolute;
    left: 0;
}

.keyboard-hint {
    font-size: 0.9rem;
    color: #999;
}

.keyboard-hint kbd {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    font-family: monospace;
    font-size: 0.85rem;
    color: #333;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ========================================
   Pagination / Load More
   ======================================== */

.search-load-more {
    text-align: center;
    padding: 1rem 0;
}

.load-more-btn {
    background: #ad1a23;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.load-more-btn:hover {
    background: #c41e28;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(173,26,35,0.3);
}

.load-more-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.loading-spinner {
    display: inline-block;
    animation: loading-spin 1s linear infinite;
}

@keyframes loading-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.search-end-message {
    text-align: center;
    padding: 2rem 1rem;
    color: #999;
    font-style: italic;
    font-size: 0.9rem;
}

/* ========================================
   Mobile Responsiveness
   ======================================== */

@media (max-width: 768px) {
    /* Search Bar */
    .search-bar {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .search-input {
        padding: 0.65rem 1rem 0.65rem 2.75rem;
        font-size: 0.95rem;
    }

    .search-icon {
        left: 0.75rem;
        font-size: 1.1rem;
    }

    .search-clear-btn {
        width: 28px;
        height: 28px;
        font-size: 1.1rem;
    }

    /* Search Filters */
    .search-filters-header {
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }

    .search-filters-content {
        padding: 0.75rem;
    }

    .filter-label {
        font-size: 0.85rem;
    }

    .date-range-inputs {
        flex-direction: column;
        gap: 0.75rem;
    }

    .date-input-wrapper {
        min-width: 0;
    }

    .department-checkboxes {
        max-height: 200px;
    }

    .department-checkbox-label {
        padding: 0.3rem 0.4rem;
    }

    .department-name {
        font-size: 0.85rem;
    }

    /* Search Results */
    .search-results-bar {
        padding: 0.6rem 0.75rem;
        margin-bottom: 0.75rem;
    }

    .search-results-text {
        font-size: 0.85rem;
    }

    .search-results-list {
        gap: 0.75rem;
    }

    /* Search Result Card */
    .search-result-card {
        padding: 1rem;
    }

    .search-snippet {
        margin-top: 0.5rem;
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    /* Empty States */
    .search-empty-state {
        padding: 2rem 1rem;
    }

    .empty-state-icon {
        font-size: 3rem;
    }

    .search-empty-state h3 {
        font-size: 1.25rem;
    }

    .search-empty-state p {
        font-size: 0.95rem;
    }

    .search-tips,
    .search-suggestions {
        padding: 1rem;
    }

    .search-tips li,
    .search-suggestions li {
        font-size: 0.9rem;
        padding: 0.4rem 0;
        padding-left: 1.25rem;
    }

    /* Load More */
    .load-more-btn {
        padding: 0.65rem 1.5rem;
        font-size: 0.9rem;
    }

    .search-end-message {
        padding: 1.5rem 1rem;
        font-size: 0.85rem;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .search-input {
        font-size: 0.9rem;
    }

    .date-label {
        font-size: 0.8rem;
    }

    .date-input {
        font-size: 0.85rem;
    }

    .department-checkboxes {
        max-height: 150px;
    }

    .search-empty-state h3 {
        font-size: 1.1rem;
    }

    .empty-state-icon {
        font-size: 2.5rem;
    }
}
