/**
 * Compass Archive Search - Styles
 * 
 * Modern, responsive styling for the search interface
 */

/* CSS Custom Properties - Compass Brand Colors */
.cas-search-container {
    --cas-primary: #0e4aff;
    --cas-primary-hover: #0a3acc;
    --cas-primary-light: #e7f0ff;
    --cas-secondary: #005a86;
    --cas-accent: #4db2ec;
    --cas-text: rgb(34, 34, 34);
    --cas-text-light: #666666;
    --cas-border: #e0e0e0;
    --cas-bg: #ffffff;
    --cas-bg-light: #f8f9fa;
    --cas-highlight: #fff3cd;
    --cas-radius: 6px;
    --cas-radius-lg: 8px;
    --cas-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --cas-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --cas-transition: 0.2s ease;
    
    font-family: 'OceanwideProRegular', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--cas-text);
    line-height: 1.5;
    max-width: 1200px;
    margin: 0 auto;
}

/* Search Header */
.cas-search-header {
    margin-top: 10px;
    margin-bottom: 10px;
}

.cas-search-form {
    width: 100%;
}

/* Search input wrapper - matches compass-archive Vue component */
.cas-search-input-wrapper {
    position: relative;
    display: flex;
    height: 56px;
    align-items: center;
    gap: 0;
    background: #ffffff;
    border: 1px solid rgba(13, 21, 35, 0.08);
    border-radius: 50px;
    padding: 0 0 0 24px;
    box-shadow: 2px 4px 56px rgba(28, 28, 28, 0.05);
    transition: border-color var(--cas-transition), box-shadow var(--cas-transition);
}

.cas-search-input-wrapper:focus-within {
    border-color: rgba(13, 21, 35, 0.15);
    box-shadow: 2px 4px 56px rgba(28, 28, 28, 0.08);
}

.cas-search-icon {
    display: none; /* Hidden in compass-archive design */
}

.cas-search-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 18px;
    color: #101526;
    outline: none;
    min-width: 0;
    padding: 12px 0;
}

.cas-search-input::placeholder {
    color: #9ca3af;
}

.cas-search-button {
    right: 0;
    position: absolute;
    background: var(--cas-primary);
    color: white;
    border: none;
    padding: 14px 40px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--cas-transition), transform var(--cas-transition);
    flex-shrink: 0;
}

.cas-search-button:hover {
    background: rgba(14, 74, 255, 0.85);
}

.cas-search-button:active {
    transform: scale(0.98);
}

/* Filters Bar - Date range section */
.cas-filters-bar {
    padding: 0;
    margin-bottom: 8px; 
}

/* Closed State: Date range + Change dates link */
.cas-date-closed-state {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cas-date-range-display {
    font-size: 16px;
    font-weight: 600;
    color: rgb(34, 34, 34);
}

.cas-change-dates {
    background: none;
    border: none;
    color: rgb(34, 34, 34) !important;
    font-family: 'OceanwideProBold', sans-serif !important;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    transition: color var(--cas-transition);
}

.cas-change-dates:hover {
    color: rgb(34, 34, 34) !important;
}

/* Open State: Full date picker */
.cas-date-open-state {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.cas-date-picker-container {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid rgba(13, 21, 35, 0.08);
    border-radius: 50px;
    height: 40px;
    padding: 6px 6px 6px 24px;
    box-shadow: 2px 4px 56px rgba(28, 28, 28, 0.05);
    gap: 8px;
}

.cas-date-inputs {
    display: flex;
    align-items: center;
    flex: 1;
}

.cas-date-field {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.cas-date-field label {
    font-size: 14px;
    color: rgba(13, 21, 35, 0.64);
    white-space: nowrap;
}

.cas-date-field .cas-date-input {
    border: none;
    background: transparent;
    padding: 8px 0;
    font-size: 14px;
    color: rgb(34, 34, 34);
    outline: none;
    width: 100%;
    max-width: 120px;
}

.cas-date-divider {
    width: 1px;
    height: 32px;
    background: rgba(13, 21, 35, 0.2);
    margin: 0 24px;
    flex-shrink: 0;
}

.cas-date-search-btn {
margin-right: -6px;
    background: var(--cas-primary);
    color: white;
    border: none;
    height: 40px;
    padding: 9px 32px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--cas-transition);
    flex-shrink: 0;
    white-space: nowrap;
}

.cas-date-search-btn:hover {
    background: rgba(14, 74, 255, 0.85);
}

.cas-date-reset-btn {
    background: none;
    border: none;
    color: rgb(34, 34, 34);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 16px;
    transition: color var(--cas-transition);
    flex-shrink: 0;
}

.cas-date-reset-btn:hover {
    color: var(--cas-primary);
}

.cas-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cas-filter-group label {
    font-size: 14px;
    font-weight: 400;
    color: rgba(13, 21, 35, 0.64);
    white-space: nowrap;
}

.cas-select,
.cas-date-input {
    padding: 8px 12px;
    border: 1px solid var(--cas-border);
    border-radius: var(--cas-radius);
    font-size: 14px;
    background: #ffffff;
    color: rgb(34, 34, 34);
    cursor: pointer;
    transition: border-color var(--cas-transition);
}

.cas-select:hover,
.cas-date-input:hover {
    border-color: var(--cas-primary);
}

.cas-select:focus,
.cas-date-input:focus {
    outline: none;
    border-color: var(--cas-primary);
    box-shadow: 0 0 0 2px var(--cas-primary-light);
}

.cas-clear-filters {
    background: none;
    border: none;
    color: var(--cas-primary);
    padding: 0;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: color var(--cas-transition);
}

.cas-clear-filters:hover {
    color: var(--cas-primary-hover);
    background: none;
}

/* Results Info Bar */
.cas-results-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 16px 0;
    border-bottom: 1px solid #D1D5DB;
    margin-bottom: 24px;
    font-size: 16px;
}

.cas-results-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cas-results-right {
    display: flex;
    align-items: center;
}

.cas-results-count {
    font-weight: 400;
    color: rgb(34, 34, 34);
}

.cas-results-query {
    font-weight: 700;
    font-family: 'OceanwideProBold', sans-serif;
    color: rgb(34, 34, 34);
}

/* Sort select in results bar */
.cas-sort-select {
    border: none;
    background: transparent;
    font-size: 16px;
    color: rgb(34, 34, 34);
    cursor: pointer;
    padding: 4px 8px;
    appearance: menulist;
}

.cas-sort-select:hover {
    border: none;
}

.cas-sort-select:focus {
    outline: none;
    box-shadow: none;
    border: none;
}

/* Loading State */
.cas-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--cas-text-light);
}

.cas-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--cas-border);
    border-top-color: var(--cas-primary);
    border-radius: 50%;
    animation: cas-spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes cas-spin {
    to { transform: rotate(360deg); }
}

/* No Results */
.cas-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--cas-text-light);
}

.cas-no-results svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.cas-no-results h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.cas-no-results p {
    margin: 0;
    font-size: 14px;
}

/* Error State */
.cas-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--cas-radius);
    padding: 16px;
    margin-bottom: 20px;
}

.cas-error-message {
    color: #dc2626;
    margin: 0;
    font-size: 14px;
}

/* Results Grid - Single column stacked layout */
.cas-results-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Card Link Wrapper */
.cas-result-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Result Card - Horizontal layout */
.cas-result-card {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    background: transparent;
    border: none;
    border-bottom: none;
    padding: 42px 0;
    gap: 24px;
}

.cas-result-card:first-child {
    padding-top: 0;
}

.cas-result-card:hover {
    background: transparent;
}

/* Content Section - Left side */
.cas-result-content {
    flex: 1;
    min-width: 0;
    max-width: 378px;
    padding: 0;
    order: 1;
}

/* Full width content when no thumbnail */
.cas-result-content:only-child {
    max-width: 100%;
}

/* Thumbnail Section - Right side */
.cas-result-thumbnail {
    flex: 0 0 285px;
    width: 285px;
    height: 185px;
    overflow: hidden;
    background: var(--cas-bg-light);
    border-radius: 4px;
    order: 2;
}

.cas-result-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--cas-transition);
}

.cas-result-card:hover .cas-result-thumbnail img {
    transform: scale(1.02);
}

/* Archive thumbnail - contain image with white background */
.cas-result-card--archive .cas-result-thumbnail {
    background: #FBF4D8 !important;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    box-sizing: border-box;
}

.cas-result-card--archive .cas-result-thumbnail img {
    width: auto !important;
    height: auto !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain !important;
}

/* Type Label (ARCHIVES) */
.cas-result-type-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #666666;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

/* Headline */
.cas-result-headline {
    font-family: 'OceanwideProBold', sans-serif;
    font-size: 20px;
    font-weight: bold;
    margin: 0 0 10px 0;
    line-height: 1.3;
    color: rgb(34, 34, 34);
}

.cas-result-headline a {
    color: rgb(34, 34, 34);
    text-decoration: none;
    transition: color var(--cas-transition);
}

.cas-result-headline a:hover {
    color: var(--cas-primary);
}

/* Highlighted text in results */
.cas-result-headline em,
.cas-result-excerpt em {
    font-style: normal;
    background: var(--cas-highlight);
    padding: 1px 4px;
    border-radius: 2px;
}

/* Excerpt */
.cas-result-excerpt {
    font-size: 17px;
    color: rgb(34, 34, 34);
    margin: 0 0 12px 0;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Date and Author */
.cas-result-meta {
    font-size: 13px;
    color: #666666;
    margin: 0;
}

.cas-result-meta .cas-result-author {
    color: rgb(34, 34, 34);
}

/* Legacy date class for backwards compatibility */
.cas-result-date {
    display: block;
    font-size: 13px;
    color: #666666;
    margin-top: 12px;
}

/* Responsive - Stack on mobile */
@media (max-width: 640px) {
    .cas-result-card {
        flex-direction: column;
        gap: 16px;
    }
    
    .cas-result-content {
        order: 2;
    }
    
    .cas-result-thumbnail {
        flex: none;
        width: 100%;
        order: 1;
        aspect-ratio: 16 / 9;
    }
    
    .cas-result-headline {
        font-size: 18px;
    }
}

/* Show More Button */
.cas-show-more-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 32px;
    margin-bottom: 198px;
    padding-top: 24px;
    gap: 20px;
}

.cas-show-more-container::before,
.cas-show-more-container::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #D1D5DB;
}

.cas-show-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2A0CEF;
    border: none;
    color: white;
    padding: 10px 24px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--cas-transition);
}

.cas-show-more-btn:hover {
    background: #2209c7;
    color: white;
}

/* Tablet/Small Desktop - Date picker stacking */
@media (max-width: 1019px) {
    
    /* Date closed state - keep horizontal */
    .cas-date-closed-state {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* Date picker - keep inputs together, only button goes below */
    .cas-date-open-state {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .cas-date-picker-container {
        flex-direction: column;
        height: auto;
        padding: 16px;
        border-radius: 16px;
        gap: 12px;
    }
    
    /* Date inputs stay horizontal */
    .cas-date-inputs {
        flex-direction: row;
        width: 100%;
        gap: 8px;
    }
    
    .cas-date-field {
        flex: 1;
    }
    
    .cas-date-field .cas-date-input {
        max-width: 100%;
    }
    
    .cas-date-divider {
        display: none;
    }
    
    .cas-date-search-btn {
        position: static;
        width: 100%;
    }
    
    .cas-date-reset-btn {
        width: 100%;
        text-align: center;
        padding: 12px 16px;
    }
}

/* Mobile Responsive */
@media (max-width: 640px) {
    
    /* Search input wrapper - keep same layout as desktop, just adjust sizing */
    .cas-search-input-wrapper {
        padding: 0 0 0 16px;
    }
    
    .cas-search-button {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .cas-filters-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .cas-filters-left {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    
    .cas-filter-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .cas-select,
    .cas-date-input {
        flex: 1;
    }
    
    .cas-filters-right {
        width: 100%;
    }
    
    .cas-clear-filters {
        width: 100%;
    }
    
    .cas-show-more-btn {
        width: 100%;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .cas-search-container {
        --cas-text: #f9fafb;
        --cas-text-light: #9ca3af;
        --cas-border: #374151;
        --cas-bg: #1f2937;
        --cas-bg-light: #111827;
        --cas-highlight: #854d0e;
    }
    
    .cas-error {
        background: #450a0a;
        border-color: #7f1d1d;
    }
    
    .cas-error-message {
        color: #fca5a5;
    }
}
