/* ================================
   PropHunt MY - Property Search
   Modern Dark Theme CSS
   ================================ */

/* CSS Custom Properties */
:root {
    --bg-primary: #0f1419;
    --bg-secondary: #1a2029;
    --bg-card: #1e2630;
    --bg-hover: #252e38;
    --bg-input: #252e38;
    --bg-input-focus: #2a3441;
    
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-muted: #6b7a8d;
    
    --accent: #00D4AA;
    --accent-hover: #00b894;
    --accent-glow: rgba(0, 212, 170, 0.15);
    --accent-border: rgba(0, 212, 170, 0.3);
    
    --danger: #ff6b6b;
    --warning: #ffd93d;
    --success: #00D4AA;
    
    --border: #2d3748;
    --border-light: #374151;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.6);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ================================
   Header
   ================================ */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(26, 32, 41, 0.95);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 28px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.logo-text {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.logo-accent {
    color: var(--accent);
}

.tagline {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
}

/* ================================
   Main
   ================================ */
.main {
    flex: 1;
    padding: 32px 0;
}

/* ================================
   Search Section
   ================================ */
.search-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 32px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
}

.search-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #00a3cc, var(--accent));
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
}

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

/* Form Groups */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.label-icon {
    font-size: 16px;
}

.label-hint {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
}

/* Inputs */
.form-input,
.form-select {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    font-family: var(--font-family);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus,
.form-select:focus {
    background: var(--bg-input-focus);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7a8d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* Autocomplete */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-height: 240px;
    overflow-y: auto;
    z-index: 50;
    display: none;
    box-shadow: var(--shadow-lg);
    animation: slideDown 200ms ease;
}

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

.autocomplete-dropdown.active {
    display: block;
}

.autocomplete-item {
    padding: 12px 18px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-primary);
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border);
}

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

.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background: var(--accent-glow);
    color: var(--accent);
}

.autocomplete-item .item-icon {
    margin-right: 8px;
}

/* Price Range */
.price-range-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.price-select-wrapper {
    flex: 1;
}

.price-separator {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    padding-top: 2px;
}

/* Pill Groups */
.pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pill {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-family);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.pill:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.pill.active {
    background: var(--accent-glow);
    border-color: var(--accent-border);
    color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.pill.active:hover {
    background: var(--accent-glow);
    border-color: var(--accent-border);
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.btn-search {
    flex: 1;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-family);
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    color: #0f1419;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 16px rgba(0, 212, 170, 0.3);
}

.btn-search:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 212, 170, 0.4);
}

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

.btn-search:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-icon {
    font-size: 18px;
}

.btn-clear {
    padding: 16px 24px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-family);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-clear:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    color: var(--text-primary);
}

/* ================================
   Search History
   ================================ */
.search-history {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    border: 1px solid var(--border);
    margin-bottom: 32px;
}

.history-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.history-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-icon {
    font-size: 14px;
}

.history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.history-item {
    padding: 8px 16px;
    font-size: 13px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.history-item:hover {
    background: var(--accent-glow);
    border-color: var(--accent-border);
    color: var(--accent);
}

/* ================================
   Loading State
   ================================ */
.loading-state {
    text-align: center;
    padding: 64px 20px;
}

.spinner {
    width: 56px;
    height: 56px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 24px;
}

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

.loading-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.loading-subtext {
    font-size: 14px;
    color: var(--text-muted);
}

/* ================================
   Error State
   ================================ */
.error-state {
    text-align: center;
    padding: 64px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 107, 107, 0.2);
}

.error-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.error-state h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--danger);
}

.error-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.btn-retry {
    padding: 12px 32px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-family);
    background: var(--danger);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-retry:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.3);
}

/* ================================
   Results Section
   ================================ */
.results-section {
    margin-bottom: 32px;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.results-info h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.search-timestamp {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.results-sort {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.sort-select {
    width: auto;
    min-width: 180px;
    padding: 10px 40px 10px 14px;
    font-size: 13px;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

/* Result Card */
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
    animation: fadeInUp 300ms ease forwards;
    opacity: 0;
    position: relative;
}

.result-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-border);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 20px var(--accent-glow);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-image {
    width: 100%;
    height: 200px;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    position: relative;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-image .placeholder {
    opacity: 0.3;
}

.card-source {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--radius-full);
    background: rgba(15, 20, 25, 0.85);
    color: var(--accent);
    border: 1px solid var(--accent-border);
    backdrop-filter: blur(8px);
}

.card-body {
    padding: 20px;
}

.card-price {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-location {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-details {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card-detail {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.card-detail .detail-icon {
    font-size: 14px;
}

.card-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.card-keyword {
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-muted);
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.card-link:hover {
    color: var(--accent-hover);
    gap: 10px;
}

.card-link-arrow {
    transition: transform var(--transition-fast);
}

.result-card:hover .card-link-arrow {
    transform: translateX(4px);
}

/* ================================
   No Results
   ================================ */
.no-results {
    text-align: center;
    padding: 64px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.no-results-icon {
    font-size: 56px;
    display: block;
    margin-bottom: 20px;
    opacity: 0.7;
}

.no-results h3 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.no-results > p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.suggestions {
    text-align: left;
    max-width: 320px;
    margin: 0 auto;
    background: var(--bg-input);
    padding: 20px 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.suggestions p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

.suggestions ul {
    list-style: none;
    padding: 0;
}

.suggestions li {
    padding: 6px 0;
    font-size: 14px;
    color: var(--text-secondary);
    padding-left: 20px;
    position: relative;
}

.suggestions li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent);
}

/* ================================
   Initial State
   ================================ */
.initial-state {
    text-align: center;
    padding: 80px 20px;
}

.hero-content h1 {
    font-size: 42px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-content > p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 48px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.stat-number {
    font-size: 32px;
}

.stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ================================
   Footer
   ================================ */
.footer {
    padding: 24px 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer p {
    font-size: 13px;
    color: var(--text-muted);
}

/* ================================
   Responsive Design
   ================================ */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .tagline {
        display: none;
    }
    
    .search-section {
        padding: 24px 20px;
    }
    
    .price-range-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .price-separator {
        display: none;
    }
    
    .pill {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-clear {
        width: 100%;
    }
    
    .hero-content h1 {
        font-size: 28px;
    }
    
    .hero-content > p {
        font-size: 15px;
    }
    
    .hero-stats {
        gap: 32px;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .results-info h2 {
        font-size: 18px;
    }
    
    .card-price {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .search-section {
        padding: 20px 16px;
    }
    
    .form-input,
    .form-select {
        padding: 12px 14px;
        font-size: 15px;
    }
    
    .pill-group {
        gap: 8px;
    }
    
    .pill {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .card-image {
        height: 180px;
    }
    
    .card-body {
        padding: 16px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Focus Visible for Accessibility */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
