/* ============================================
   InmoPerú — Portal Inmobiliario
   Colores: Azul (#1a3a5c, #2563eb) + Amarillo (#f59e0b, #fbbf24)
   ============================================ */

:root {
    --blue-900: #0f2942;
    --blue-800: #1a3a5c;
    --blue-700: #1e4d7b;
    --blue-600: #2563eb;
    --blue-500: #3b82f6;
    --blue-100: #dbeafe;
    --blue-50: #eff6ff;
    --yellow-500: #f59e0b;
    --yellow-400: #fbbf24;
    --yellow-300: #fcd34d;
    --yellow-100: #fef3c7;
    --gray-900: #111827;
    --gray-700: #374151;
    --gray-500: #6b7280;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.1), 0 10px 10px rgba(0,0,0,0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--gray-900);
    background: var(--gray-50);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

a { text-decoration: none; color: inherit; transition: var(--transition); }
img { max-width: 100%; height: auto; }

/* ---- NAVBAR ---- */
.navbar {
    background: var(--blue-900);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--white);
    font-size: 1.5rem;
    font-weight: 300;
}

.logo i { color: var(--yellow-400); font-size: 1.6rem; }
.logo strong { color: var(--yellow-400); font-weight: 700; }

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

.nav-menu a {
    color: rgba(255,255,255,0.85);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-menu a:hover { color: var(--white); background: rgba(255,255,255,0.1); }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
}

/* ---- HERO ---- */
.hero {
    background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-700) 100%);
    padding: 5rem 0 4rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(251,191,36,0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.hero h1 {
    color: var(--white);
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    position: relative;
}

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

.hero p {
    color: rgba(255,255,255,0.8);
    font-size: 1.2rem;
    margin-bottom: 2.5rem;
    position: relative;
}

/* ---- SEARCH BOX ---- */
.search-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-xl);
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

.search-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

.search-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
}

.search-group select,
.search-group input {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--gray-700);
    background: var(--white);
    transition: var(--transition);
}

.search-group select:focus,
.search-group input:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--yellow-500);
    color: var(--blue-900);
}

.btn-primary:hover {
    background: var(--yellow-400);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--blue-600);
    color: var(--white);
}

.btn-secondary:hover {
    background: var(--blue-500);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--blue-600);
    border: 2px solid var(--blue-600);
}

.btn-outline:hover {
    background: var(--blue-600);
    color: var(--white);
}

.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1.1rem; }

/* ---- STATS BAR ---- */
.stats-bar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1.5rem 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    text-align: center;
}

.stat-item h3 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--blue-600);
}

.stat-item p {
    color: var(--gray-500);
    font-size: 0.9rem;
}

/* ---- SECTION ---- */
.section {
    padding: 4rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--blue-900);
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--gray-500);
    font-size: 1.05rem;
}

.section-header .accent { color: var(--yellow-500); }

/* ---- PROPERTY CARDS ---- */
.properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.property-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.property-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.property-image {
    position: relative;
    height: 220px;
    overflow: hidden;
}

.property-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.property-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-venta { background: var(--blue-600); color: var(--white); }
.badge-alquiler { background: var(--yellow-500); color: var(--blue-900); }

.badge-destacado {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--yellow-400);
    color: var(--blue-900);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.property-info { padding: 1.25rem; }

.property-price {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.property-price .main-price {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--blue-800);
}

.property-price .alt-price {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.property-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--gray-900);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.property-location {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.property-location i { color: var(--yellow-500); margin-right: 0.3rem; }

.property-features {
    display: flex;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--gray-500);
}

.feature i { color: var(--blue-500); font-size: 0.9rem; }

/* ---- CATEGORIES ---- */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.category-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 2px solid transparent;
}

.category-card:hover {
    border-color: var(--yellow-400);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.category-card i {
    font-size: 2.5rem;
    color: var(--blue-600);
    margin-bottom: 1rem;
}

.category-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.category-card p {
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* ---- CTA ---- */
.cta {
    background: linear-gradient(135deg, var(--blue-800) 0%, var(--blue-600) 100%);
    padding: 4rem 0;
    text-align: center;
    color: var(--white);
}

.cta h2 { font-size: 2rem; margin-bottom: 1rem; }
.cta p { color: rgba(255,255,255,0.8); margin-bottom: 2rem; font-size: 1.1rem; }

/* ---- DETAIL PAGE ---- */
.detail-header { padding: 2rem 0 1rem; }

.breadcrumb {
    display: flex;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--gray-500);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.breadcrumb a { color: var(--blue-600); }
.breadcrumb a:hover { text-decoration: underline; }

.detail-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
    padding-bottom: 3rem;
}

.gallery {
    border-radius: var(--radius);
    overflow: hidden;
}

.gallery-main {
    width: 100%;
    height: 450px;
    object-fit: cover;
    border-radius: var(--radius);
}

.gallery-thumbs {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.gallery-thumbs img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    opacity: 0.6;
    transition: var(--transition);
}

.gallery-thumbs img:hover,
.gallery-thumbs img.active { opacity: 1; }

.detail-sidebar {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 90px;
}

.detail-price {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--blue-800);
    margin-bottom: 0.3rem;
}

.detail-price-alt {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.detail-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.detail-feature {
    text-align: center;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

.detail-feature i {
    color: var(--blue-500);
    font-size: 1.2rem;
    display: block;
    margin-bottom: 0.3rem;
}

.detail-feature .value {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--gray-900);
}

.detail-feature .label {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* ---- CONTACT FORM (sidebar) ---- */
.contact-form h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--blue-800);
}

.form-group { margin-bottom: 1rem; }

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.form-group textarea { resize: vertical; min-height: 80px; }

/* ---- SEARCH RESULTS ---- */
.search-results {
    padding: 2rem 0 4rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-count {
    font-size: 1.1rem;
    color: var(--gray-700);
}

.results-count strong { color: var(--blue-600); }

.sort-select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    color: var(--gray-700);
}

/* ---- PAGINATION ---- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.pagination a,
.pagination span {
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
}

.pagination a {
    background: var(--white);
    color: var(--gray-700);
    box-shadow: var(--shadow-sm);
}

.pagination a:hover {
    background: var(--blue-50);
    color: var(--blue-600);
}

.pagination .current {
    background: var(--blue-600);
    color: var(--white);
}

/* ---- CONTACT PAGE ---- */
.contact-page {
    padding: 3rem 0;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.contact-info-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.contact-info-card h2 {
    font-size: 1.5rem;
    color: var(--blue-800);
    margin-bottom: 1.5rem;
}

.info-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-item i {
    width: 45px;
    height: 45px;
    background: var(--blue-50);
    color: var(--blue-600);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.info-item h4 {
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.info-item p {
    color: var(--gray-500);
    font-size: 0.9rem;
}

.contact-form-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.contact-form-card h2 {
    font-size: 1.5rem;
    color: var(--blue-800);
    margin-bottom: 1.5rem;
}

/* ---- ALERT ---- */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ---- FOOTER ---- */
.footer {
    background: var(--blue-900);
    color: rgba(255,255,255,0.8);
    padding: 3rem 0 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 2rem;
    padding-bottom: 2rem;
}

.footer-col h3,
.footer-col h4 {
    color: var(--white);
    margin-bottom: 1rem;
}

.footer-col h3 strong { color: var(--yellow-400); }

.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.5rem; }
.footer-col a:hover { color: var(--yellow-400); }

.social-links {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.social-links a {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1rem;
}

.social-links a:hover {
    background: var(--yellow-500);
    color: var(--blue-900);
}

.footer-bottom {
    text-align: center;
    padding: 1.5rem 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.85rem;
}

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state i {
    font-size: 4rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-menu {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--blue-900);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow-lg);
    }
    .nav-menu.active { display: flex; }
    .hero h1 { font-size: 2rem; }
    .hero { padding: 3rem 0 2.5rem; }
    .search-row { grid-template-columns: 1fr 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
    .properties-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .gallery-main { height: 280px; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .contact-grid { grid-template-columns: 1fr; }
    .categories-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .search-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .categories-grid { grid-template-columns: 1fr; }
}

/* ---- ADMIN STYLES ---- */
.admin-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: var(--blue-900);
    color: var(--white);
    padding: 1.5rem 0;
}

.admin-sidebar .logo {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 1rem;
}

.admin-nav { list-style: none; }

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.7);
    font-size: 0.95rem;
    transition: var(--transition);
}

.admin-nav a:hover,
.admin-nav a.active {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}

.admin-nav a.active { border-left: 3px solid var(--yellow-400); }
.admin-nav i { width: 20px; text-align: center; }

.admin-content {
    padding: 2rem;
    background: var(--gray-50);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.admin-header h1 {
    font-size: 1.5rem;
    color: var(--blue-800);
}

/* Admin table */
.admin-table {
    width: 100%;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border-collapse: collapse;
}

.admin-table th {
    background: var(--blue-50);
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9rem;
}

.admin-table tr:hover { background: var(--gray-50); }

.admin-table img {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
}

.admin-actions {
    display: flex;
    gap: 0.5rem;
}

.admin-actions a,
.admin-actions button {
    padding: 0.35rem 0.65rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.admin-edit { background: var(--blue-50); color: var(--blue-600); }
.admin-edit:hover { background: var(--blue-100); }
.admin-delete { background: #fee2e2; color: #dc2626; }
.admin-delete:hover { background: #fecaca; }

/* Admin form */
.admin-form {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.admin-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.admin-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.3rem;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.admin-stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.admin-stat-card h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--blue-600);
}

.admin-stat-card p {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.admin-stat-card i {
    font-size: 1.5rem;
    color: var(--yellow-500);
    margin-bottom: 0.5rem;
}

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--blue-900), var(--blue-700));
}

.login-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
}

.login-card h1 {
    text-align: center;
    color: var(--blue-800);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.login-card .subtitle {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { display: none; }
    .admin-stats { grid-template-columns: 1fr 1fr; }
    .admin-form .form-row { grid-template-columns: 1fr; }
}
