/**
 * TAHN Search Interface Styles
 * Matches the design from screenshots with modern, clean UI
 */

/* ===== Search Container ===== */
#tahn-search,
#tahn-listings {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== Status Filter Bar (for Listings) ===== */
.tahn-status-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding: 16px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tahn-status-btn {
    padding: 10px 20px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.tahn-status-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.tahn-status-btn.active {
    background: #6C3DF4;
    border-color: #6C3DF4;
    color: #fff;
}

.tahn-status-btn:focus {
    outline: 2px solid #6C3DF4;
    outline-offset: 2px;
}

/* ===== Search Header ===== */
.tahn-search-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 1 px 3px rgba(0,0,0,0.1);
}

.tahn-search-location {
    flex: 1;
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 12px;
}

#tahn-location-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

#tahn-location-input::placeholder {
    color: #9ca3af;
}

.tahn-distance {
    font-size: 14px;
    color: #6b7280;
    white-space: nowrap;
}

#tahn-distance-select {
    padding: 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

#tahn-distance-display {
    font-weight: 600;
    color: #111827;
}

.tahn-search-filters-top {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tahn-search-filters-top select {
    padding: 10px 36px 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%23666" d="M10.293 3.293 6 7.586 1.707 3.293A1 1 0 0 0 .293 4.707l5 5a1 1 0 0 0 1.414 0l5-5a1 1 0 1 0-1.414-1.414z"/></svg>') no-repeat right 12px center;
    appearance: none;
    cursor: pointer;
}

.tahn-filter-toggle,
.tahn-save-search,
.tahn-clear-search {
    padding: 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.tahn-filter-toggle:hover,
.tahn-save-search:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.tahn-clear-search {
    background: #1e293b;
    color: white;
    border-color: #1e293b;
}

.tahn-clear-search:hover {
    background: #0f172a;
}

/* ===== Advanced Filters Panel ===== */
.tahn-advanced-filters {
    background: #f9fafb;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e5e7eb;
}

.tahn-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.tahn-filter-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 12px 0;
}

.tahn-filter-section label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}

.tahn-filter-section input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.tahn-filter-btn {
    display: inline-block;
    padding: 8px 16px;
    margin: 4px 4px 4px 0;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    background: white;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}

.tahn-filter-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
}

.tahn-filter-btn.active {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

.tahn-filter-please-show {
    grid-column: 1 / -1;
}

.tahn-filter-please-show .tahn-filter-btn {
    margin-right: 8px;
    margin-bottom: 8px;
}

#tahn-added-to-site {
    width: 100%;
    padding: 10px 36px 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%23666" d="M10.293 3.293 6 7.586 1.707 3.293A1 1 0 0 0 .293 4.707l5 5a1 1 0 0 0 1.414 0l5-5a1 1 0 1 0-1.414-1.414z"/></svg>') no-repeat right 12px center;
    appearance: none;
    cursor: pointer;
}

/* ===== Search Controls (View Toggle + Results Count) ===== */
.tahn-search-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 20px;
}

.tahn-view-toggle {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 8px;
}

.tahn-view-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tahn-view-btn:hover {
    color: #111827;
}

.tahn-view-btn.active {
    background: white;
    color: #111827;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.tahn-results-count {
    font-size: 14px;
    color: #6b7280;
}

#tahn-results-number {
    font-weight: 600;
    color: #111827;
    font-size: 16px;
}

#tahn-view-results {
    margin-left: 12px;
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
}

#tahn-view-results:hover {
    text-decoration: underline;
}

/* ===== Main Content Area ===== */
.tahn-search-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    min-height: 600px;
}

.tahn-search-content[data-view="list"] {
    grid-template-columns: 1fr;
}

.tahn-search-content[data-view="list"] .tahn-map-container {
    display: none;
}

.tahn-search-content[data-view="map"] {
    grid-template-columns: 1fr;
}

.tahn-search-content[data-view="map"] .tahn-results-list {
    display: none;
}

/* ===== Results List ===== */
.tahn-results-list,
.tahn-results-grid {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

/* Grid view - compact cards */
.tahn-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

.tahn-results-grid .tahn-deal-card {
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    padding: 0;
    transition: all 0.2s;
    cursor: pointer;
}

.tahn-results-grid .tahn-deal-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.tahn-results-grid .tahn-deal-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.tahn-results-grid .tahn-deal-info {
    padding: 16px;
}

.tahn-results-grid .tahn-deal-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px 0;
}

.tahn-deal-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.tahn-save-deal-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: all 0.2s;
    flex-shrink: 0;
}

.tahn-save-deal-icon:hover {
    color: #dc2626;
    transform: scale(1.1);
}

.tahn-save-deal-icon.saved {
    color: #dc2626;
}

.tahn-save-deal-icon svg {
    width: 20px;
    height: 20px;
}

.tahn-results-grid .tahn-deal-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
    flex: 1;
}

.tahn-results-grid .tahn-deal-location {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 12px;
}

.tahn-results-grid .tahn-deal-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.tahn-results-grid .tahn-deal-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: capitalize;
}

.tahn-results-grid .tahn-deal-badge.social-rent {
    background: #dbeafe;
    color: #1e40af;
}

.tahn-results-grid .tahn-deal-badge.shared-ownership {
    background: #e0e7ff;
    color: #5b21b6;
}

.tahn-results-grid .tahn-deal-meta {
    font-size: 13px;
    color: #374151;
    margin-bottom: 8px;
}

.tahn-results-grid .tahn-deal-meta strong {
    font-weight: 600;
    color: #111827;
}

.tahn-results-grid .tahn-deal-price {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin: 12px 0 8px 0;
}

.tahn-results-grid .tahn-deal-badge-alt {
    display: inline-block;
    padding: 6px 14px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px;
    margin-top: 8px;
}

/* List view - expanded cards */
.tahn-results-list {
    display: flex;
    flex-direction: column;
}

.tahn-loading {
    padding: 60px 20px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

.tahn-results-list .tahn-deal-card {
    display: grid;
    grid-template-columns: 200px 1fr auto;
    gap: 20px;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.2s;
    cursor: pointer;
    align-items: start;
}

.tahn-results-list .tahn-deal-card:hover {
    background: #f9fafb;
}

.tahn-results-list .tahn-deal-card:last-child {
    border-bottom: none;
}

.tahn-results-list .tahn-deal-image {
    width: 200px;
    height: 150px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.tahn-results-list .tahn-deal-info {
    flex: 1;
    min-width: 0;
}

.tahn-results-list .tahn-deal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
}

.tahn-results-list .tahn-deal-title {
    font-size: 22px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px 0;
}

.tahn-results-list .tahn-deal-location {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 12px;
}

.tahn-results-list .tahn-deal-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.tahn-results-list .tahn-deal-badge {
    display: inline-block;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 16px;
    text-transform: capitalize;
}

.tahn-results-list .tahn-deal-badge.social-rent {
    background: #dbeafe;
    color: #1e40af;
}

.tahn-results-list .tahn-deal-badge.shared-ownership {
    background: #e0e7ff;
    color: #5b21b6;
}

.tahn-results-list .tahn-deal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    font-size: 14px;
    color: #374151;
    margin-bottom: 16px;
}

.tahn-results-list .tahn-deal-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tahn-results-list .tahn-deal-description {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 16px;
}

.tahn-results-list .tahn-deal-price {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.tahn-results-list .tahn-deal-badge-alt {
    display: inline-block;
    padding: 8px 16px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 13px;
    font-weight: 500;
    border-radius: 20px;
}

.tahn-results-list .tahn-deal-aside {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.tahn-results-list .tahn-deal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 140px;
}

/* Deal card common styles */
.tahn-deal-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.tahn-deal-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.tahn-deal-btn {
    padding: 10px 20px;
    border: 2px solid transparent;
    border-radius: 6px;
    background: #ffffff;
    color: #000000;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-image:
        linear-gradient(#ffffff, #ffffff),
        linear-gradient(135deg, #8C3EFA, #209DD9);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

.tahn-deal-btn.primary {
    background: #0E1937;
    color: #ffffff;
    background-image:
        linear-gradient(#0E1937, #0E1937),
        linear-gradient(135deg, #8C3EFA, #209DD9);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

.tahn-deal-btn:hover:not(:disabled) {
    background-image:
        linear-gradient(#f8f9fa, #f8f9fa),
        linear-gradient(135deg, #8C3EFA, #209DD9);
    transform: translateY(-1px);
}

.tahn-deal-btn.primary:hover:not(:disabled) {
    background-image:
        linear-gradient(#1a2650, #1a2650),
        linear-gradient(135deg, #8C3EFA, #209DD9);
    box-shadow: 0 4px 12px rgba(140, 62, 250, 0.3);
}

.tahn-deal-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tahn-deal-btn.saved {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}

.tahn-deal-btn.saved:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.tahn-deal-btn svg {
    flex-shrink: 0;
}

.tahn-save-deal-btn svg {
    width: 16px;
    height: 16px;
}

/* ===== Map Container ===== */
.tahn-map-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    min-height: 600px;
}

.tahn-map-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    border: 2px dashed #d1d5db;
}

.tahn-map-placeholder-content {
    text-align: center;
    color: #6b7280;
}

.tahn-map-placeholder-content p {
    margin: 16px 0 0 0;
    font-size: 14px;
    line-height: 1.5;
}

.tahn-map-placeholder-content small {
    font-size: 12px;
    color: #9ca3af;
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .tahn-search-content {
        grid-template-columns: 1fr;
    }
    
    .tahn-map-container {
        min-height: 400px;
    }
    
    .tahn-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .tahn-results-list .tahn-deal-card {
        grid-template-columns: 150px 1fr;
        gap: 16px;
    }
    
    .tahn-results-list .tahn-deal-image {
        width: 150px;
        height: 120px;
    }
    
    .tahn-results-list .tahn-deal-aside {
        grid-column: 2;
        align-items: flex-start;
        flex-direction: row;
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .tahn-search-header {
        flex-direction: column;
    }
    
    .tahn-search-location {
        min-width: 100%;
    }
    
    .tahn-search-filters-top {
        width: 100%;
    }
    
    .tahn-search-filters-top select,
    .tahn-search-filters-top button {
        flex: 1;
        min-width: 140px;
    }
    
    .tahn-filters-grid {
        grid-template-columns: 1fr;
    }
    
    .tahn-filter-please-show {
        grid-column: 1;
    }
    
    .tahn-search-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .tahn-view-toggle {
        justify-content: center;
    }
    
    .tahn-results-count {
        text-align: center;
    }
    
    .tahn-results-grid {
        grid-template-columns: 1fr;
        padding: 12px;
        gap: 16px;
    }
    
    .tahn-results-list .tahn-deal-card {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px;
    }
    
    .tahn-results-list .tahn-deal-image {
        width: 100%;
        height: 180px;
    }
    
    .tahn-results-list .tahn-deal-aside {
        grid-column: 1;
        flex-direction: column;
        align-items: stretch;
    }
    
    .tahn-results-list .tahn-deal-actions {
        min-width: 100%;
    }
}

/* ===== Pagination ===== */
.tahn-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
    padding: 20px 0;
    grid-column: 1 / -1;
}

.tahn-page-btn {
    padding: 8px 12px;
    min-width: 40px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    transition: all 0.2s;
}

.tahn-page-btn:hover {
    background: #f3f4f6;
    border-color: #2563eb;
}

.tahn-page-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.tahn-page-dots {
    padding: 8px 4px;
    color: #9ca3af;
}

/* ===== Filter Results Count ===== */
.tahn-filter-results-count {
    padding: 16px;
    margin-top: 20px;
    background: #f9fafb;
    border-radius: 6px;
    text-align: center;
    font-size: 15px;
    color: #374151;
}

.tahn-filter-results-count strong {
    color: #2563eb;
    font-weight: 600;
}
