/* ===== VARIABLES ===== */
:root {
    --primary: #1e2d3d;
    --primary-dark: #152029;
    --secondary: #800020;
    --accent: #4ecdc4;
    --text-light: #ffffff;
    --text-gray: #a0aec0;
    --bg-dark: #0f1922;
    --bg-card: #243447;
    --success: #48bb78;
    --warning: #ecc94b;
    --danger: #f56565;
    --border-radius: 12px;
}

/* ===== RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--secondary);
}

/* ===== HEADER ===== */
.header {
    background: var(--primary);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    border-bottom: 3px solid #800020;
}

.header-top {
    background: #800020;
    text-align: center;
    padding: 0.4rem 1rem;
}

.header-top a {
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 500;
}

.header-top a:hover {
    color: var(--accent);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.8rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo span {
    color: var(--secondary);
}

.nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav a {
    color: var(--text-light);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s;
}

.nav a:hover {
    background: var(--bg-card);
    color: var(--accent);
}

.nav .btn-publicar {
    background: var(--secondary);
    color: white;
}

.nav .btn-publicar:hover {
    background: #ff5252;
    color: white;
}

/* ===== CONTENEDOR PRINCIPAL ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ===== HERO ===== */
.hero {
    text-align: center;
    padding: 0.8rem 1rem 1.2rem 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    border: 3px solid #800020;
}

.hero h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.hero h1 span {
    color: #800020;
}

.hero p {
    color: var(--text-gray);
    font-size: 1rem;
    margin-bottom: 0.8rem;
}

/* ===== BUSCADOR ===== */
.search-box {
    display: flex;
    gap: 0.4rem;
    max-width: 1000px;
    margin: 0 auto;
    flex-wrap: wrap;
    justify-content: center;
}

.search-box select,
.search-box input {
    padding: 0.35rem 0.8rem;
    border: 2px solid #800020;
    border-radius: 50px;
    font-size: 0.85rem;
    background: var(--bg-card);
    color: var(--text-light);
    min-width: 120px;
}

.search-box select:focus,
.search-box input:focus {
    outline: 2px solid var(--accent);
}

.search-box button {
    padding: 0.35rem 1rem;
    background: var(--secondary);
    color: white;
    border: 2px solid #800020;
    border-radius: 50px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.3s;
}

.search-box button:hover {
    background: #600018;
}

/* ===== CATEGORÍAS ===== */
.categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.category-card {
    background: var(--bg-card);
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius);
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    border: 2px solid #800020;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    background: var(--primary);
}

.category-card .icon {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
}

.category-card h3 {
    color: var(--text-light);
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
}

.category-card p {
    color: var(--text-gray);
    font-size: 0.75rem;
}

/* ===== TARJETAS DE ANUNCIOS - FORMATO LISTA ===== */
.anuncios-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 2rem 0;
}

.anuncio-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.3s;
    display: flex;
    flex-direction: row;
    border: 1px solid #800020;
    height: 182px;
}

.anuncio-card:hover {
    box-shadow: 0 5px 20px rgba(128,0,32,0.3);
}

.anuncio-card .content {
    padding: 0.5rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden;
}

.anuncio-card .content > a:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.anuncio-card h3 {
    margin: 0;
    color: var(--text-light);
    font-size: 1.1rem;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.anuncio-card .location {
    color: var(--text-gray);
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.anuncio-card .price {
    color: #800020;
    font-size: 1.1rem;
    font-weight: bold;
}

.anuncio-card .badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #1e3a5f;
    color: #fff;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid #800020;
}

/* Contenedor de imagen con botones */
.anuncio-img-container {
    position: relative;
    flex-shrink: 0;
    width: 180px;
    height: 140px;
}

.anuncio-img-container a {
    display: block;
    height: 100%;
}

.anuncio-img-container img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.anuncio-btns {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0;
    z-index: 10;
}

.btn-llamar, .btn-whatsapp, .btn-telefono {
    text-decoration: none;
    transition: transform 0.2s;
}

.btn-llamar {
    background: var(--accent);
    color: var(--primary-dark);
    padding: 8px 12px;
    border-radius: 8px;
}

.btn-telefono {
    background: #000;
    color: #fff;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 5px 8px;
    border-radius: 0 8px 0 0;
}

.btn-whatsapp {
    background: #25D366;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 8px;
    border-radius: 8px 0 0 0;
}

.btn-llamar:hover, .btn-whatsapp:hover, .btn-telefono:hover {
    transform: scale(1.05);
}

/* Header del anuncio: título a la izquierda, etiquetas a la derecha */
.anuncio-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 5px;
}

.anuncio-header h3 {
    flex: 1;
    margin: 0;
}

/* Etiquetas alineadas a la derecha - en la misma línea */
.tags-right {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-shrink: 0;
}

/* Fila de título + tags */
.titulo-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 5px;
}

.badge-tiempo {
    background: #1e3a5f;
    color: #fff;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    border: 1px solid #800020;
}

.badge-provincia {
    background: #1e3a5f;
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    border: 1px solid #800020;
}

.badge-id {
    background: #1e3a5f;
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    border: 1px solid #800020;
}

/* Ocultar la ubicación de abajo */
.ubicacion-right {
    display: none;
}

/* Descripción con recuadro - ocupa todo el alto */
.descripcion-preview {
    color: #e0e0e0;
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 0;
    padding: 8px 12px;
    background: rgba(30, 45, 61, 0.6);
    border: 1px solid #800020;
    border-radius: 8px;
    flex: 1;
}
}

.badge-provincia {
    background: var(--accent);
    color: var(--primary-dark);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    display: inline-block;
    font-weight: 500;
}

/* Descripción preview */
.descripcion-preview {
    color: var(--text-gray);
    font-size: 0.8rem;
    line-height: 1.4;
    margin: 0.3rem 0;
    max-height: 4.5em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

/* Responsive: en móvil vuelve a vertical */
@media (max-width: 600px) {
    .anuncio-card {
        flex-direction: column;
    }
    .anuncio-card img {
        width: 100%;
        height: 180px;
    }
}

/* ===== FORMULARIOS ===== */
.form-container {
    max-width: 500px;
    margin: 2rem auto;
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--border-radius);
}

.form-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-light);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-gray);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid transparent;
    border-radius: 8px;
    background: var(--primary);
    color: var(--text-light);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group textarea {
    min-height: 150px;
    resize: vertical;
}

.btn {
    display: inline-block;
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: var(--secondary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #ff5252;
}

.btn-secondary {
    background: var(--accent);
    color: var(--primary-dark);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

/* ===== ALERTAS ===== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(72, 187, 120, 0.2);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-error {
    background: rgba(245, 101, 101, 0.2);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.alert-warning {
    background: rgba(236, 201, 75, 0.2);
    border: 1px solid var(--warning);
    color: var(--warning);
}

/* ===== PANEL DE USUARIO/ADMIN ===== */
.panel-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    min-height: calc(100vh - 200px);
}

.sidebar {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    height: fit-content;
}

.sidebar h3 {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--primary);
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 0.5rem;
}

.sidebar-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-light);
    border-radius: 8px;
    transition: all 0.3s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: var(--primary);
    color: var(--accent);
}

.panel-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--border-radius);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--primary);
}

/* ===== TABLA ===== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--primary);
}

.table th {
    background: var(--primary);
    color: var(--text-gray);
    font-weight: 600;
}

.table tr:hover {
    background: var(--primary);
}

.status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.status-active {
    background: rgba(72, 187, 120, 0.2);
    color: var(--success);
}

.status-pending {
    background: rgba(236, 201, 75, 0.2);
    color: var(--warning);
}

.status-rejected {
    background: rgba(245, 101, 101, 0.2);
    color: var(--danger);
}

/* ===== ESTADÍSTICAS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--primary);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    text-align: center;
}

.stat-card .number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent);
}

.stat-card .label {
    color: var(--text-gray);
    margin-top: 0.5rem;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--primary);
    padding: 0.8rem 1rem 0.4rem;
    margin-top: 1.5rem;
    border-top: 2px solid #800020;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
}

.footer-section {
    flex: 1;
    min-width: 140px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.2rem;
}

.footer-section h4 {
    color: #ffffff;
    margin-bottom: 0.4rem;
    font-size: 1rem;
    font-weight: bold;
}

.footer-section p {
    color: #ffffff;
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.4;
}

.footer-section ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-section li {
    margin-bottom: 0.25rem;
}

.footer-section a {
    color: #ffffff;
    font-size: 0.95rem;
}

.footer-section a:hover {
    color: var(--accent);
}

.footer-bottom {
    text-align: center;
    padding-top: 0.5rem;
    margin-top: 0.6rem;
    border-top: 1px solid var(--bg-card);
    color: #ffffff;
    font-size: 0.9rem;
}

/* ===== VERIFICACIÓN DE EDAD ===== */
.age-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.age-modal-content {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 500px;
}

.age-modal-content h2 {
    color: var(--secondary);
    margin-bottom: 1rem;
}

.age-modal-content p {
    color: var(--text-gray);
    margin-bottom: 2rem;
}

.age-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.age-buttons button {
    padding: 1rem 3rem;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.age-buttons .btn-yes {
    background: var(--success);
    color: white;
}

.age-buttons .btn-no {
    background: var(--danger);
    color: white;
}

/* ===== BOTONES DE ACCIONES EN PANEL ===== */
.acciones-cell {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.btn-accion {
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
    transition: all 0.2s;
}

.btn-accion.btn-ver {
    background: var(--accent);
    color: var(--primary-dark);
}

.btn-accion.btn-editar {
    background: #f39c12;
    color: #000;
}

.btn-accion.btn-pagar {
    background: var(--success);
    color: white;
}

.btn-accion.btn-eliminar {
    background: var(--danger);
    color: white;
}

.btn-accion:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .hero h1 {
        font-size: 1.8rem;
    }
    
    .panel-container {
        grid-template-columns: 1fr;
    }
    
    .search-box {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box select,
    .search-box input,
    .search-box button {
        width: 100%;
    }
    
    .table {
        font-size: 0.9rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
}
