/* ================================
   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;
}

/* ================================
   Status Bar
   ================================ */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.status-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.count-badge {
    padding: 6px 14px;
    background: var(--accent-glow);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-full);
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
}

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

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

.sort-select {
    padding: 6px 12px;
    font-size: 13px;
    font-family: var(--font-family);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
}

.sort-select:focus {
    border-color: var(--accent);
}

.btn-refresh {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    transition: all var(--transition-fast);
}

.btn-refresh:hover {
    background: var(--bg-hover);
    border-color: var(--accent-border);
    color: var(--accent);
}

.btn-refresh:active {
    transform: rotate(180deg);
}

/* ─── State Stats ──────────────────────────── */
.state-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 14px 18px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
.state-pill {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
}
.state-pill strong {
    color: var(--text-primary);
    font-size: 13px;
}

/* ─── Lead Tags Row ───────────────────────── */
.lead-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.lead-tag {
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: var(--radius-full);
    background: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.lead-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
}

/* ─── Lead Images ─────────────────────────── */
.lead-images {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.lead-image {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

/* ================================
   Lead Cards
   ================================ */
.lead-grid {
    display: grid;
    gap: 16px;
}

.lead-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-normal);
    cursor: pointer;
}

.lead-card:hover {
    border-color: var(--accent-border);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.lead-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 12px;
}

.lead-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lead-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-glow);
    border: 1px solid var(--accent-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--accent);
    flex-shrink: 0;
}

.lead-username {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.lead-dates {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.lead-date {
    font-size: 12px;
    color: var(--text-muted);
}

.lead-scraped {
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.6;
}

.lead-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 16px;
}

.lead-footer {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.lead-footer .lead-tag {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-full);
    background: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.lead-footer .lead-tag.threads-link {
    background: rgba(0, 212, 170, 0.1);
    color: var(--accent);
    border-color: var(--accent-border);
}

.lead-footer .lead-tag.threads-link:hover {
    background: rgba(0, 212, 170, 0.2);
}

/* ================================
   Loading
   ================================ */
.loading {
    text-align: center;
    padding: 64px 20px;
    color: var(--text-muted);
    font-size: 16px;
}

.loading::before {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.empty-state {
    text-align: center;
    padding: 64px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-text {
    font-size: 16px;
    margin-bottom: 8px;
}

.empty-subtext {
    font-size: 14px;
}

.error-state {
    text-align: center;
    padding: 64px 20px;
    color: var(--danger);
}

/* ================================
   Footer
   ================================ */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    margin-top: auto;
}

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

/* ================================
   Responsive
   ================================ */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
        text-align: center;
    }
    
    .status-left, .status-right {
        justify-content: center;
    }
    
    .lead-card-header {
        flex-direction: column;
    }
    
    .lead-dates {
        align-items: flex-start;
    }
}
