/* SCARAL MASTER ENGINE INTEGRATION */
@import url('system/scaral-master.css');

/* 🏛️ Unified Search Orchestrator (EDA v4.5 - Precision Slim) */
.sc-search-orchestrator {
    max-width: 900px;
    margin: 0 auto;
    padding: 4px;
    background: rgba(3, 7, 18, 0.4);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 0px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 0 1px 1px rgba(255, 255, 255, 0.05);
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sc-search-orchestrator:hover {
    border-color: rgba(var(--sc-color-primary-rgb), 0.4);
    background: rgba(3, 7, 18, 0.6);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5), 0 0 15px rgba(var(--sc-color-primary-rgb), 0.1);
    transform: translateY(-1px);
}

.search-main-input {
    flex: 2.5;
    background: transparent;
    border: none;
    color: white;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 400;
    outline: none;
    letter-spacing: 0.3px;
}

.search-main-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.08);
}

.search-select-inline {
    flex: 1;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.9); /* Increased contrast */
    font-size: 0.85rem;
    padding: 8px 15px;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    transition: color 0.3s;
}

/* 🛡️ Legibility Fix: Ensure dropdown options are readable on all browsers */
select option {
    background-color: #0f172a; /* Deep dark slate */
    color: white;
    padding: 10px;
}

.search-select-inline:hover {
    color: white;
}

.sc-btn--compact-glow {
    width: 38px;
    height: 38px;
    border-radius: 50% !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sc-color-primary);
    box-shadow: 0 5px 15px rgba(var(--sc-color-primary-rgb), 0.4);
    transition: all 0.3s;
}

.sc-btn--compact-glow:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(var(--sc-color-primary-rgb), 0.6);
}

.sc-btn--compact-glow i {
    font-size: 0.9rem;
}

/* --- Public Landing Page Orchestration (EDA v3.0 Override) --- */
html, body {
    overflow: visible !important;
    overflow-x: hidden !important;
    height: auto !important;
}

body {
    background-color: var(--sc-surface-dark);
}

/* 🏔️ Strategic Section Orchestrator (EDA Standard Missing in Core) */
.sc-section {
    position: relative;
    padding: var(--sc-space-2xl) 0;
    width: 100%;
    overflow: hidden;
}

@media (max-width: 768px) {
    .sc-section {
        padding: var(--sc-space-xl) 0;
    }
}

.sc-section--hero {
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    padding-top: calc(var(--sc-header-height-desktop) + var(--sc-space-2xl));
}

@media (max-width: 1024px) {
    .sc-section--hero {
        min-height: 60vh;
        padding-top: calc(var(--sc-header-height-mobile) + var(--sc-space-xl));
    }
}

.sc-section__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(3, 7, 18, 0.4) 0%, rgba(3, 7, 18, 0.95) 100%);
    z-index: 1;
}

/* 🛡️ No Sidebar Orchestration */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --- Marketplace Specific Styles (Enterprise Sync v3.0) --- */
:root {
    --market-bg: var(--sc-surface-dark);
    --market-card-bg: var(--sc-surface-glass);
    --market-accent: var(--sc-color-accent);
    --market-text-gold: var(--sc-color-gold);
    --market-teal: var(--sc-color-primary);
    --glass-nav: rgba(3, 7, 18, 0.7);
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    background-color: var(--market-bg);
    color: #f8fafc;
    overflow-x: hidden;
    font-family: 'Outfit', 'Noto Sans Thai', sans-serif;
    margin: 0;
    width: 100%;
    max-width: 100vw;
}

/* --- Navigation Bar --- */
/* Default hidden elements (Mobile specific) - Managed by Global Protocols */
.sc-bottom-nav {
    display: none;
}

/* --- Global Header Identity Orchestration (EDA v3.0) --- */
/* Legacy Identity Clusters removed. Now governed by ui-utils.module.js Kernel */


/* --- Hero Section --- */
.hero-section {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background-size: cover;
    background-position: center;
    overflow: hidden;
    padding-top: 160px;
    /* Offset for fixed navbar + breathing room */
}

/* Enhanced Gradient Overlay */
.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(3, 7, 18, 0.2) 0%, rgba(3, 7, 18, 0.9) 100%);
    z-index: 1;
}

/* Gradient text accent */
.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    width: 100%;
    max-width: 900px;
    padding: 0 20px;
    margin-top: 60px;
}

.hero-title {
    font-size: 3.8rem;
    /* Hero is exceptionally larger, but consistent */
    font-weight: 800;
    letter-spacing: -2px;
    color: white;
    margin-bottom: var(--sc-space-md);
    line-height: 1.1;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.hero-subtitle {
    font-size: 1.3rem;
    color: #cbd5e1;
    font-weight: 300;
    margin-bottom: 50px;
    letter-spacing: 0.5px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Floating Search Bar (Refined) --- */
.search-container {
    background: rgba(255, 255, 255, 0.7);
    /* Lighter for readability */
    backdrop-filter: blur(20px);
    padding: 8px 15px;
    border-radius: 60px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    display: inline-flex;
    align-items: center;
    width: 100%;
    max-width: 750px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease;
}

.search-container:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.search-input {
    background: transparent;
    border: none;
    color: #334155;
    /* Darker text for input */
    font-size: 1.1rem;
    font-weight: 500;
    flex-grow: 1;
    padding: var(--sc-space-sm) 15px;
    outline: none;
}

/* Secondary Filters - Minimalist Tags */
.filter-dropdown {
    padding: 6px 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15); /* Slightly stronger border */
    background: rgba(255, 255, 255, 0.05); /* Slightly darker bg */
    color: rgba(255, 255, 255, 0.85); /* Increased contrast */
    font-size: 0.75rem;
    font-weight: 500; /* Medium weight for better readability */
    backdrop-filter: blur(5px);
    transition: all 0.3s;
    appearance: none;
    background-image: none; 
    text-align: center;
}

.filter-dropdown:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(var(--sc-color-primary-rgb), 0.3);
    color: white;
}

.search-btn {
    background: var(--sc-gradient-premium);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.search-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(188, 0, 255, 0.4);
}

/* --- Pulse Strip (Modern Stats) --- */
.sc-pulse-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sc-space-2xl);
    padding: 15px 40px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    margin: 40px auto 0 auto;
    width: fit-content;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    transition: all 0.4s ease;
}

.sc-pulse-strip:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.sc-pulse-item {
    display: flex;
    align-items: center;
    gap: var(--sc-space-md);
}

.sc-pulse-item:not(:last-child) {
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding-right: var(--sc-space-2xl);
}

.sc-pulse-icon {
    font-size: 1.1rem;
    color: var(--sc-color-primary);
    filter: drop-shadow(0 0 8px rgba(var(--sc-color-primary-rgb), 0.5));
}

.pulse-glow {
    position: relative;
    display: inline-block;
}

.pulse-glow::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: var(--sc-color-success);
    border-radius: 50%;
    opacity: 0.8;
    box-shadow: 0 0 10px var(--sc-color-success);
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}

.sc-pulse-data {
    display: flex;
    flex-direction: column;
}

.sc-pulse-val {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1;
    color: white;
    letter-spacing: -0.5px;
}

.sc-pulse-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.sc-color-online { color: #10b981; }
.sc-color-ai { color: #bc00ff; }

/* --- Collections (Cards) --- */
.cat-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.6), rgba(15, 23, 42, 0.8));
    padding: var(--sc-space-xl);
    border-radius: var(--sc-space-lg);
    border: 1px solid var(--sc-glass-border);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.cat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.03), transparent);
    transform: translateX(-100%);
    transition: 0.5s;
}

.cat-card:hover::before {
    transform: translateX(100%);
}

.cat-card:hover {
    transform: translateY(-10px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.cat-icon-box {
    width: 60px;
    height: 60px;
    border-radius: var(--sc-space-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--sc-space-lg);
    font-size: 1.8rem;
    transition: transform 0.3s;
}

.cat-card:hover .cat-icon-box {
    transform: scale(1.1) rotate(5deg);
}

/* --- Properties Grid & Cards (CRITICAL FIX) --- */
.collection-grid,
#featured-projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--sc-space-xl);
    width: 100%;
    max-width: var(--sc-container-max);
    margin: 0 auto;
    padding: 40px var(--sc-space-md);
    box-sizing: border-box;
}

.card,
.project-card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--sc-glass-border);
    border-radius: var(--sc-space-lg);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.card:hover,
.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: var(--market-accent);
}

/* --- Improved Image Slider for Property Cards --- */
/* --- Improved Image Slider for Property Cards (Mobile Touch Optimized) --- */
.card-img-container {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 220px;
    background: #1e293b;
    z-index: 1;
}

.card-slider-track {
    display: flex;
    height: 100%;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.card-slider-track::-webkit-scrollbar {
    display: none;
}

.card-slider-track img {
    width: 100%;
    min-width: 100%;
    /* Ensure full width in flex */
    height: 100%;
    object-fit: cover;
    flex-shrink: 0;
    scroll-snap-align: center;
    -webkit-user-drag: none;
    user-select: none;
}

.slider-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 var(--sc-space-sm);
    pointer-events: none;
    z-index: 10;
    /* Above images */
    opacity: 1;
    /* Ensure visible for now to test */
}

@media (hover: hover) {
    .card:hover .slider-controls {
        opacity: 1;
    }
}

/* Always show subtle arrows if multiple for better discovery */
.slider-controls {
    opacity: 0.6;
    transition: opacity 0.3s;
}

.card:hover .slider-controls {
    opacity: 1;
}

.slider-btn {
    width: var(--sc-space-xl);
    height: var(--sc-space-xl);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.2s;
    font-size: 0.75rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.slider-btn:hover {
    background: var(--market-accent);
    transform: scale(1.1);
    border-color: white;
}

.slider-indicators {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.25);
    padding: 4px 7px;
    border-radius: var(--sc-space-lg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    pointer-events: none;
}

/* 🛡️ Strategic Badge Enrichment (Contrast Fix) */
.sc-badge--dark {
    background: rgba(3, 7, 18, 0.85) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
}

.sc-badge--success {
    background: rgba(16, 185, 129, 0.9) !important;
    backdrop-filter: blur(8px);
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    padding: 6px 12px !important;
    border-radius: 8px !important;
}

.sc-badge--warning {
    background: rgba(245, 158, 11, 0.9) !important;
    backdrop-filter: blur(8px);
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
    padding: 6px 12px !important;
    border-radius: 8px !important;
}

.slider-indicators .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.slider-indicators .dot.active {
    background: white;
    width: 12px;
    border-radius: 3px;
}

/* Base Image Style */
.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Remove hover scale as it breaks scroll layout */
.project-card:hover img {
    transform: scale(1.1);
    transition: transform 0.6s ease;
}

.card-content {
    padding: var(--sc-space-lg);
    color: #cbd5e1;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 5px 0 10px 0;
    line-height: 1.4;
}

.card-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--market-teal);
    margin-bottom: 5px;
}

.ai-badge {
    display: inline-block;
    background: linear-gradient(90deg, hsl(var(--sc-accent)), #059669);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: var(--sc-space-sm);
}

.card-tag {
    position: absolute;
    top: var(--sc-space-md);
    right: var(--sc-space-md);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 60px;
    color: #64748b;
    font-size: 0.9rem;
    border-top: 1px solid var(--sc-glass-border);
    background: #020617;
}

/* --- AI Chatbot Interface (Modern Glass) --- */
#ai-chat-wrapper {
    position: fixed;
    bottom: var(--sc-space-xl);
    right: var(--sc-space-xl);
    z-index: 9999;
}

#chat-toggle-btn {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--market-accent), #7a20c2);
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(188, 0, 255, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#chat-toggle-btn:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 15px 40px rgba(188, 0, 255, 0.6);
}

.chat-btn-pulse {
    animation: chat-pulse 2s infinite;
}

@keyframes chat-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(188, 0, 255, 0.4);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(188, 0, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(188, 0, 255, 0);
    }
}

#chat-window {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: 380px;
    height: 550px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(25px);
    border: 1px solid var(--sc-glass-border);
    border-radius: 25px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8);
}

.chat-hidden {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
}

.chat-header {
    padding: var(--sc-space-lg);
    background: var(--sc-glass-border);
    border-bottom: 1px solid var(--sc-glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--market-teal), #0891b2);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    color: black;
}

#close-chat {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.2rem;
}

#chat-messages {
    flex-grow: 1;
    padding: var(--sc-space-lg);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--sc-space-md);
    scrollbar-width: thin;
    scrollbar-color: var(--market-accent) transparent;
}

.message {
    max-width: 85%;
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.5;
    animation: msg-fade-in 0.3s ease;
}

@keyframes msg-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
    border-bottom-left-radius: 4px;
}

.message.user {
    align-self: flex-end;
    background: var(--market-accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-input-area {
    padding: var(--sc-space-md) 20px;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    gap: var(--sc-space-sm);
    align-items: center;
}

#user-input {
    flex-grow: 1;
    background: var(--sc-glass-border);
    border: 1px solid var(--sc-glass-border);
    color: white;
    padding: 12px 20px;
    border-radius: 50px;
    outline: none;
    font-size: 0.9rem;
}

#send-msg {
    background: var(--market-accent);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
}

#send-msg:hover {
    transform: scale(1.1);
}

/* --- Responsive Optimizations (Modularized) --- */
/* Note: Mobile logic moved to index-mobile.css for architectural purity v3.0.1 */

/* Extra Small Devices */
@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-content>div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}