@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Noto+Sans+Sinhala:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #f5f7fa; /* Clean light navy-grey background */
    --bg-card: rgba(255, 255, 255, 0.98); /* Solid white cards */
    --bg-card-hover: #ffffff;
    --border-color: rgba(11, 44, 92, 0.08); /* Subtle navy tint border */
    --border-color-focus: rgba(204, 164, 59, 0.4); /* Gold focus */
    
    --text-primary: #0f172a; /* Dark slate */
    --text-secondary: #334155; /* Mid slate */
    --text-muted: #64748b; /* Soft slate */
    
    --primary: #0b2c5c; /* Premium Navy Blue */
    --primary-hover: #153e75;
    --primary-gradient: linear-gradient(135deg, #071e3d, #153e75);
    
    --gold: #cca43b; /* Premium Metallic Gold */
    --gold-hover: #b89332;
    --gold-gradient: linear-gradient(135deg, #cca43b, #d4af37);
    --gold-light: rgba(204, 164, 59, 0.08);
    
    --land-color: #0d9488; /* Teal */
    --land-gradient: linear-gradient(135deg, #0f766e, #0d9488);
    
    --vehicle-color: #7c3aed; /* Purple */
    --vehicle-gradient: linear-gradient(135deg, #6d28d9, #7c3aed);
    
    --whatsapp-color: #16a34a; /* WhatsApp green */
    --whatsapp-gradient: linear-gradient(135deg, #15803d, #16a34a);
    
    --danger: #ef4444;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(11, 44, 92, 0.04), 0 4px 6px -2px rgba(11, 44, 92, 0.02);
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

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

body {
    font-family: 'Outfit', 'Noto Sans Sinhala', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(11, 44, 92, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(204, 164, 59, 0.03) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition-fast);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Layout container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    display: flex;
    align-items: center;
    color: var(--primary);
    position: relative;
    padding-left: 112px; /* Space for the 100px absolute logo badge */
}

.logo-img {
    position: absolute;
    left: 0;
    top: -10px; /* Hangs down from the top, extending past the 80px navbar height */
    height: 100px;
    width: 100px;
    object-fit: contain;
    border-radius: 50%; /* Crop the square white background corners of the JPEG */
    z-index: 110; /* Float on top of the bottom border and page content */
    transition: var(--transition-normal);
}

.logo:hover .logo-img {
    transform: scale(1.05);
}

.logo span {
    color: var(--gold);
    margin-left: 6px;
}

.nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
    list-style: none;
}

.nav-links a {
    font-weight: 600;
    color: var(--text-secondary);
    position: relative;
    padding: 8px 0;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition-fast);
}

.nav-links a:hover::after, .nav-links a.active::after {
    width: 100%;
}

.btn-post {
    background: var(--primary-gradient);
    color: #fff !important;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(11, 44, 92, 0.15);
}

.btn-post:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(11, 44, 92, 0.3);
}

.btn-post::after {
    display: none !important;
}

/* Footer */
footer {
    background: #0f172a; /* Keep footer dark for premium contrast */
    color: #f8fafc;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding: 48px 0 24px;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .nav-links {
        display: none;
    }
}

.footer-brand h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #ffffff;
}

.footer-brand p {
    color: #94a3b8;
    font-size: 14px;
    max-width: 320px;
}

.footer-links h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #ffffff;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #94a3b8;
    font-size: 14px;
}

.footer-links a:hover {
    color: #ffffff;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #64748b;
}

/* Hero Section */
.hero {
    padding: 80px 0 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero h1 {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 20px;
    line-height: 1.2;
    color: var(--text-primary);
}

.hero h1 span {
    color: var(--primary);
}

.hero p {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
}

/* Search and Filter Panel */
.search-filter-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-width: 800px;
    margin: 0 auto;
}

.search-form {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 16px;
    align-items: center;
}

@media (max-width: 768px) {
    .search-form {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.form-group label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-control {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition-fast);
}

.form-control:focus {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(11, 44, 92, 0.15);
}

.btn-search {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(11, 44, 92, 0.15);
    align-self: flex-end;
    height: 46px;
}

.btn-search:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(11, 44, 92, 0.3);
}

/* Sinhala Purpose Banner */
.purpose-banner {
    background: linear-gradient(135deg, rgba(11, 44, 92, 0.04), rgba(204, 164, 59, 0.03));
    border: 1px solid rgba(204, 164, 59, 0.2);
    border-radius: 20px;
    padding: 40px;
    margin: 40px auto 60px;
    text-align: center;
    max-width: 900px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.purpose-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.7) 0%, transparent 70%);
    pointer-events: none;
}

.purpose-badge {
    display: inline-block;
    background: var(--gold-light);
    color: var(--primary);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 20px;
    border: 1px solid rgba(204, 164, 59, 0.25);
}

.purpose-title-si {
    font-family: 'Noto Sans Sinhala', sans-serif;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.purpose-desc-si {
    font-family: 'Noto Sans Sinhala', sans-serif;
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-secondary);
    max-width: 750px;
    margin: 0 auto 24px;
}

.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--whatsapp-gradient);
    color: #fff;
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.2);
    transition: var(--transition-normal);
}

.btn-whatsapp:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(22, 163, 74, 0.35);
}

.btn-whatsapp svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Section Title */
.section-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
}

.section-title span {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 400;
}

/* Listings Grid */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 32px;
    margin-bottom: 80px;
}

/* Card */
.ad-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.ad-card:hover {
    transform: translateY(-8px);
    border-color: var(--gold);
    box-shadow: var(--shadow-md);
}

.ad-image-container {
    height: 200px;
    position: relative;
    overflow: hidden;
    background: #e2e8f0;
}

.ad-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-normal);
}

.ad-card:hover .ad-image-container img {
    transform: scale(1.05);
}

.ad-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fff;
    z-index: 2;
    box-shadow: var(--shadow-sm);
}

.ad-badge.land {
    background: var(--land-gradient);
}

.ad-badge.vehicle {
    background: var(--vehicle-gradient);
}

.ad-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.ad-price {
    font-size: 22px;
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 8px;
}

.ad-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
    line-height: 1.4;
}

.ad-title a:hover {
    color: var(--primary);
}

.ad-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.detail-tag {
    background: rgba(11, 44, 92, 0.04);
    border: 1px solid rgba(11, 44, 92, 0.06);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.ad-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid rgba(11, 44, 92, 0.06);
    margin-top: auto;
    font-size: 13px;
    color: var(--text-muted);
}

.ad-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ad-card-actions {
    padding: 0 24px 24px;
}

.btn-inquire {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(22, 163, 74, 0.08);
    color: var(--whatsapp-color);
    border: 1px solid rgba(22, 163, 74, 0.15);
    padding: 10px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    width: 100%;
    transition: var(--transition-normal);
}

.btn-inquire:hover {
    background: var(--whatsapp-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.2);
}

.btn-inquire svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Post Ad Form Styles */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-width: 700px;
    margin: 40px auto 80px;
    padding: 40px;
}

.form-title {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 8px;
    text-align: center;
    color: var(--text-primary);
}

.form-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
    font-size: 14px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group-full {
    margin-bottom: 20px;
}

.form-group-full label, .form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: block;
}

.dynamic-section {
    border-top: 1px dashed var(--border-color);
    margin-top: 24px;
    padding-top: 24px;
}

.btn-submit {
    background: var(--primary-gradient);
    color: white;
    border: none;
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(11, 44, 92, 0.15);
    transition: var(--transition-normal);
    margin-top: 20px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(11, 44, 92, 0.3);
}

.type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.type-option {
    border: 2px solid var(--border-color);
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-fast);
    font-weight: 700;
    color: var(--text-secondary);
}

.type-option:hover {
    border-color: rgba(11, 44, 92, 0.2);
}

.type-radio {
    display: none;
}

.type-radio:checked + .type-option {
    border-color: var(--primary);
    background: rgba(11, 44, 92, 0.04);
    color: var(--primary);
}

/* Image preview CSS */
.file-upload-wrapper {
    position: relative;
    border: 2px dashed rgba(11, 44, 92, 0.2);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: var(--transition-fast);
}

.file-upload-wrapper:hover {
    border-color: var(--primary);
    background: rgba(11, 44, 92, 0.02);
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Message / Notification banners */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: rgba(22, 163, 74, 0.08);
    color: #15803d;
    border: 1px solid rgba(22, 163, 74, 0.15);
}

.alert-error {
    background: rgba(239, 68, 68, 0.08);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

/* Admin Dashboard CSS */
.admin-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 40px 0 24px;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-num {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 8px;
}

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

.admin-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
    gap: 8px;
}

.admin-tab {
    padding: 12px 24px;
    cursor: pointer;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: var(--transition-fast);
}

.admin-tab:hover, .admin-tab.active {
    color: var(--primary);
}

.admin-tab.active {
    border-bottom-color: var(--primary);
}

.table-responsive {
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 60px;
    box-shadow: var(--shadow-sm);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th {
    background: rgba(11, 44, 92, 0.03);
    color: var(--text-secondary);
    font-weight: 700;
    padding: 16px 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

.admin-table td {
    padding: 16px 20px;
    font-size: 14px;
    border-bottom: 1px solid rgba(11, 44, 92, 0.05);
    vertical-align: middle;
    color: var(--text-secondary);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: rgba(11, 44, 92, 0.01);
}

.table-thumb {
    width: 60px;
    height: 45px;
    border-radius: 4px;
    object-fit: cover;
    background: #e2e8f0;
}

.badge-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-status.pending {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.badge-status.approved {
    background: rgba(11, 44, 92, 0.08);
    color: var(--primary);
}

.badge-status.rejected {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.action-btns {
    display: flex;
    gap: 8px;
}

.btn-action {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    color: #fff;
    transition: var(--transition-fast);
}

.btn-action.approve {
    background: #16a34a;
}

.btn-action.approve:hover {
    background: #15803d;
}

.btn-action.reject {
    background: #ea580c;
}

.btn-action.reject:hover {
    background: #c2410c;
}

.btn-action.delete {
    background: #dc2626;
}

.btn-action.delete:hover {
    background: #b91c1c;
}

/* Empty State */
.empty-state {
    padding: 60px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    stroke: var(--text-muted);
    margin-bottom: 16px;
}

/* Admin Login Card */
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
}

.login-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 24px;
    text-align: center;
    color: var(--text-primary);
}
