/* --- DIZAINO SISTEMA --- */
:root {
    --primary: #166534; /* Tamsi miško žalia - solidumas */
    --primary-light: #22c55e; /* Ryškesnė žalia akcentams */
    --bg-body: #f8fafc;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; }
.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }

/* --- HEADER (Navigacija) --- */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: 72px;
    position: sticky; top: 0; z-index: 1000;
}
.header-content {
    display: flex; justify-content: space-between; align-items: center; height: 100%;
}
.logo {
    font-size: 20px; font-weight: 800; color: var(--primary);
    display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: -0.5px;
}
.nav-menu { display: flex; gap: 30px; }
.nav-link { font-weight: 600; color: var(--text-main); font-size: 15px; }
.nav-link:hover { color: var(--primary); }
.header-actions { display: flex; gap: 15px; align-items: center; }

.btn-outline {
    border: 1px solid var(--border); padding: 8px 16px; border-radius: 8px; font-weight: 600; font-size: 14px;
    background: white; cursor: pointer; display: inline-block;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary {
    background: var(--primary); color: white; padding: 10px 20px; border-radius: 8px; font-weight: 600; font-size: 14px;
    border: none; cursor: pointer; display: inline-block;
}
.btn-primary:hover { background: #14532d; }

/* Flash Messages */
.flash-message {
    padding: 15px 0;
    position: relative;
}
.flash-success {
    background: #d1fae5;
    color: #065f46;
}
.flash-error {
    background: #fee2e2;
    color: #991b1b;
}
.flash-close {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: inherit;
}

/* --- HERO SEKCIJA (Su paieška) --- */
.hero {
    background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.4)), url('https://images.unsplash.com/photo-1542718610-a1d656d1884c?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80');
    background-size: cover; background-position: center;
    padding: 80px 0 100px; text-align: center; color: white;
}
.hero h1 { font-size: 48px; font-weight: 800; margin-bottom: 15px; }
.hero p { font-size: 18px; color: rgba(255,255,255,0.9); margin-bottom: 40px; }

/* PAIEŠKOS JUOSTA */
.search-box {
    background: white; padding: 8px; border-radius: 16px;
    display: inline-flex; width: 100%; max-width: 850px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.search-field {
    flex: 1; padding: 10px 20px; border-right: 1px solid #f1f5f9; text-align: left;
}
.search-field:last-of-type { border-right: none; }

.field-label { display: block; font-size: 11px; font-weight: 700; color: var(--primary); text-transform: uppercase; margin-bottom: 4px; }
.field-input { 
    width: 100%; border: none; font-size: 16px; font-weight: 600; outline: none; 
    color: var(--text-main); background: transparent; cursor: pointer; 
}
.field-input select { width: 100%; border: none; font-size: 16px; font-weight: 600; outline: none; background: transparent; cursor: pointer; }

.btn-search {
    background: var(--primary); color: white; border: none; width: 56px; border-radius: 10px;
    font-size: 20px; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center;
}
.btn-search:hover { background: #14532d; }

/* --- LOGIŠKOS KATEGORIJOS --- */
.categories-section { padding: 40px 0; }
.cat-grid { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; }

.cat-card {
    background: white; border: 1px solid var(--border); padding: 20px; border-radius: 12px;
    width: 180px; text-align: center; cursor: pointer; transition: 0.3s;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.cat-card:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow-card); }
.cat-card i { font-size: 28px; color: var(--primary); }
.cat-card span { font-weight: 600; font-size: 15px; }
.cat-count { font-size: 12px; color: var(--text-muted); }

/* --- SĄRAŠAS (GRID) --- */
.section-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 30px; margin-top: 40px; }
.section-title h2 { font-size: 28px; font-weight: 700; }

.listings-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 30px;
}
.card {
    background: white; border-radius: 16px; overflow: hidden; border: 1px solid var(--border);
    transition: 0.3s; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }
.card-img-wrap { position: relative; height: 220px; }
.card-img { width: 100%; height: 100%; object-fit: cover; }
.card-badge {
    position: absolute; top: 15px; left: 15px; background: white; padding: 5px 12px;
    border-radius: 20px; font-size: 12px; font-weight: 700; color: var(--text-main);
}
.card-content { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }

.card-location { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.card-title { font-size: 18px; font-weight: 700; margin-bottom: 12px; line-height: 1.4; }

.specs { display: flex; gap: 15px; font-size: 13px; color: var(--text-muted); margin-bottom: 20px; flex-wrap: wrap; }
.spec-item { display: flex; align-items: center; gap: 6px; }
.card-footer {
    margin-top: auto; padding-top: 15px; border-top: 1px solid #f1f5f9;
    display: flex; justify-content: space-between; align-items: center;
}
.price { font-weight: 700; font-size: 18px; color: var(--primary); }
.price span { font-size: 12px; color: var(--text-muted); font-weight: 400; }

/* --- REGIONAI (SEO) --- */
.regions-list {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px;
}
.region-link {
    background: white; padding: 15px; border-radius: 8px; border: 1px solid var(--border);
    font-weight: 600; display: flex; justify-content: space-between; align-items: center;
}
.region-link:hover { border-color: var(--primary); color: var(--primary); }
.count-badge { background: #f1f5f9; padding: 2px 8px; border-radius: 10px; font-size: 12px; color: var(--text-muted); }

/* --- FORMS --- */
.form-container {
    max-width: 600px; margin: 40px auto; background: white; padding: 40px; border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}
.form-group { margin-bottom: 20px; }
.form-label {
    display: block; font-weight: 600; margin-bottom: 8px; color: var(--text-main);
}
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 15px; font-family: inherit; transition: 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22, 101, 52, 0.1);
}
.form-textarea { min-height: 120px; resize: vertical; }
.form-error { color: #dc2626; font-size: 14px; margin-top: 5px; }
.form-help { color: var(--text-muted); font-size: 13px; margin-top: 5px; }

/* Dashboard */
.dashboard-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px;
}
.properties-table {
    width: 100%; background: white; border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border);
}
.properties-table th {
    background: #f8fafc; padding: 15px; text-align: left; font-weight: 600; border-bottom: 1px solid var(--border);
}
.properties-table td { padding: 15px; border-bottom: 1px solid var(--border); }
.properties-table tr:last-child td { border-bottom: none; }
.status-badge {
    padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: 600;
}
.status-active { background: #d1fae5; color: #065f46; }
.status-draft { background: #fef3c7; color: #92400e; }
.status-inactive { background: #fee2e2; color: #991b1b; }

/* Property Detail */
.property-header {
    background: white; padding: 30px; border-radius: var(--radius); margin-bottom: 30px;
}
.property-gallery {
    display: grid; grid-template-columns: 2fr 1fr; gap: 10px; margin-bottom: 30px;
    height: 500px;
}
.property-gallery-main {
    border-radius: var(--radius); overflow: hidden;
}
.property-gallery-main img {
    width: 100%; height: 100%; object-fit: cover;
}
.property-gallery-thumbs {
    display: grid; grid-template-rows: repeat(2, 1fr); gap: 10px;
}
.property-gallery-thumbs img {
    width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); cursor: pointer;
}

/* Map */
#map { height: 400px; width: 100%; border-radius: var(--radius); margin-top: 20px; }

/* --- FOOTER --- */
footer { background: #1e293b; color: #cbd5e1; padding: 60px 0 20px; margin-top: 80px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 40px; margin-bottom: 40px; }
.footer-title { color: white; font-weight: 700; margin-bottom: 20px; }
.footer-links li { margin-bottom: 10px; }
.footer-links a:hover { color: white; }

/* Search Page Layout */
.search-layout {
    display: flex; gap: 30px; flex-wrap: wrap;
}
.search-layout-with-map {
    display: grid; 
    grid-template-columns: 280px 1fr 450px; 
    gap: 30px;
    align-items: start;
}
.search-filters {
    flex: 0 0 280px;
}
.filter-box {
    background: white; padding: 20px; border-radius: var(--radius); 
    border: 1px solid var(--border); position: sticky; top: 90px;
}
.search-results {
    flex: 1; min-width: 0;
}
.search-results-list {
    min-width: 0;
}
.search-map-sidebar {
    position: sticky; top: 90px; height: calc(100vh - 110px);
    max-height: 800px;
}
.map-container {
    background: white; padding: 20px; border-radius: var(--radius); 
    border: 1px solid var(--border); height: 100%;
    display: flex; flex-direction: column;
}

/* Listings List View */
.listings-list {
    display: flex; flex-direction: column; gap: 20px;
}
.listing-item {
    background: white; border-radius: var(--radius); border: 1px solid var(--border);
    display: flex; gap: 20px; padding: 0; overflow: hidden; transition: 0.3s;
    text-decoration: none; color: inherit;
}
.listing-item:hover {
    transform: translateY(-2px); box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}
.listing-image {
    flex: 0 0 280px; height: 200px; position: relative; overflow: hidden;
}
.listing-image img {
    width: 100%; height: 100%; object-fit: cover;
}
.listing-image .card-badge {
    position: absolute; top: 15px; left: 15px; z-index: 2;
}
.listing-content {
    flex: 1; padding: 20px; display: flex; flex-direction: column; justify-content: space-between;
}
.listing-header {
    display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px;
}
.listing-title {
    font-size: 20px; font-weight: 700; margin: 0; flex: 1; line-height: 1.4;
}
.listing-price {
    font-weight: 700; font-size: 20px; color: var(--primary); margin-left: 20px; white-space: nowrap;
}
.listing-price span {
    font-size: 14px; color: var(--text-muted); font-weight: 400;
}
.listing-location {
    color: var(--text-muted); font-size: 14px; margin-bottom: 15px;
}
.listing-specs {
    display: flex; gap: 15px; flex-wrap: wrap; margin-bottom: 10px;
}
.spec-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: #f1f5f9; padding: 6px 12px; border-radius: 6px;
    font-size: 13px; color: var(--text-main);
}
.listing-rating {
    display: flex; align-items: center; gap: 5px; margin-top: auto;
    font-size: 14px;
}

/* Pagination */
.pagination {
    display: flex; justify-content: center; gap: 10px; margin-top: 40px;
    flex-wrap: wrap; align-items: center;
}
.pagination-numbers {
    display: flex; gap: 5px; flex-wrap: wrap;
}
.pagination-btn, .pagination-number {
    min-width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
    padding: 0 12px;
}

/* Responsive */
@media(max-width: 768px) {
    .hero h1 { font-size: 32px; }
    .search-box { flex-direction: column; padding: 15px; }
    .search-field { border-right: none; border-bottom: 1px solid #f1f5f9; padding: 15px; }
    .search-field:last-of-type { border-bottom: none; }
    .btn-search { width: 100%; height: 48px; margin-top: 10px; }
    .nav-menu { display: none; }
    .header-actions .btn-outline:first-child { display: none; }
    .listings-grid { grid-template-columns: 1fr; }
    .property-gallery { grid-template-columns: 1fr; height: auto; }
    .form-container { padding: 20px; }
    
    /* Search Page Mobile */
    #filterToggle { display: flex !important; }
    .search-layout-with-map { 
        grid-template-columns: 1fr; 
        gap: 20px; 
    }
    .search-layout { flex-direction: column; gap: 20px; }
    .search-filters {
        position: fixed; top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0, 0, 0, 0.5); z-index: 2000; 
        display: none; padding: 15px; overflow-y: auto;
        flex: none; align-items: flex-start; justify-content: center;
    }
    .search-filters.active {
        display: flex;
    }
    .filter-box {
        position: relative; top: auto; width: 100%; max-width: 400px; 
        margin: auto; max-height: 90vh; overflow-y: auto;
        background: white; border-radius: var(--radius);
        animation: slideUp 0.3s ease-out;
    }
    @keyframes slideUp {
        from {
            transform: translateY(20px);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    .filter-close-btn { display: block !important; }
    .search-results { flex: none; width: 100%; }
    .search-results-list { width: 100%; }
    .search-map-sidebar { 
        position: relative; 
        top: auto; 
        height: 400px; 
        order: -1; /* Show map before results on mobile */
    }
    .map-container { height: 100%; }
    #searchMap { min-height: 400px !important; }
    
    /* Mobile List View */
    .listing-item {
        flex-direction: column;
    }
    .listing-image {
        flex: none; width: 100%; height: 200px;
    }
    .listing-header {
        flex-direction: column; gap: 10px;
    }
    .listing-price {
        margin-left: 0;
    }
    
    /* Mobile container spacing */
    .container { margin-top: 20px !important; }
    
    /* Mobile Pagination */
    .pagination {
        flex-direction: column; gap: 15px;
    }
    .pagination-numbers {
        justify-content: center; width: 100%;
    }
    .pagination-btn, .pagination-number {
        flex: 1; min-width: 50px; max-width: 80px;
    }
    
    /* Mobile Typography */
    .search-results h1 { font-size: 24px !important; }
    .container { padding: 0 15px; }
}

@media(max-width: 480px) {
    .hero h1 { font-size: 28px; }
    .hero p { font-size: 16px; }
    .search-results h1 { font-size: 22px !important; }
    .pagination-btn, .pagination-number {
        min-width: 44px; font-size: 14px;
    }
}

