:root {
    --sec-blue: #0d6efd;
    --sec-blue-dark: #084298;
    --sec-navy: #0a2540;
    --sec-red: #C91A2D;
    --sec-red-dark: #9e1424;
    --sec-sand: #f5f7fb;
    --sec-border: #e6ebf2;
    --sec-text: #1f2a37;
    --sec-muted: #6b7280;
}

body {
    font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--sec-text);
    background: #fff;
}

a { color: var(--sec-blue); }
a:hover { color: var(--sec-blue-dark); }

.topbar {
    background: var(--sec-navy);
    color: #fff;
    font-size: 0.82rem;
}

.topbar a { color: rgba(255,255,255,.85); text-decoration: none; }
.topbar a:hover { color: #fff; }
.logout-form { display: inline; margin: 0; }
.logout-form button {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.topbar .logout-form button { color: rgba(255,255,255,.85); }
.topbar .logout-form button:hover { color: #fff; }

.topbar-login {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 999px;
    padding: .15rem .75rem .15rem .55rem;
    font-weight: 600;
}
.topbar-login i { font-size: 1.05rem; line-height: 1; }
.topbar-login:hover {
    background: rgba(255,255,255,.22);
    color: #fff;
}

.site-header {
    background: #fff;
    box-shadow: 0 1px 0 var(--sec-border);
}

.navbar-brand img { height: 50px; width: auto; }

.navbar-nav .nav-link {
    font-weight: 600;
    color: #334155;
    padding: 0.55rem 0.8rem;
}

.navbar-nav .nav-link.active,
.navbar-nav .nav-link:hover {
    color: var(--sec-blue);
}

.btn-primary {
    --bs-btn-bg: var(--sec-red);
    --bs-btn-border-color: var(--sec-red);
    --bs-btn-hover-bg: var(--sec-red-dark);
    --bs-btn-hover-border-color: var(--sec-red-dark);
    --bs-btn-active-bg: var(--sec-red-dark);
    --bs-btn-active-border-color: var(--sec-red-dark);
    --bs-btn-disabled-bg: var(--sec-red);
    --bs-btn-disabled-border-color: var(--sec-red);
}

.btn-outline-primary {
    --bs-btn-color: var(--sec-red);
    --bs-btn-border-color: var(--sec-red);
    --bs-btn-hover-bg: var(--sec-red);
    --bs-btn-hover-border-color: var(--sec-red);
    --bs-btn-active-bg: var(--sec-red-dark);
    --bs-btn-active-border-color: var(--sec-red-dark);
}

.hero-section {
    min-height: 420px;
    background:
        radial-gradient(circle at 18% 20%, rgba(213, 43, 30, .22), transparent 42%),
        linear-gradient(135deg, #07192e 0%, #0a2540 45%, #084298 100%);
    display: flex;
    align-items: center;
}

.hero-kicker {
    letter-spacing: .12em;
    text-transform: uppercase;
    font-size: .75rem;
    font-weight: 700;
    color: rgba(255,255,255,.8);
}

.search-panel {
    margin-top: -2.5rem;
    position: relative;
    z-index: 2;
}

.search-card {
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .12);
}

.stat-pill {
    padding: 1.1rem 1rem;
    border-radius: .9rem;
    background: var(--sec-sand);
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--sec-blue-dark);
}

.stat-label { font-size: .9rem; color: var(--sec-muted); }

.section-title {
    font-weight: 700;
    letter-spacing: -.02em;
}

.category-card,
.company-card,
.news-card,
.listing-card {
    border: 1px solid var(--sec-border);
    border-radius: .9rem;
    background: #fff;
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
}

.category-card:hover,
.company-card:hover,
.news-card:hover,
.listing-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 .75rem 1.5rem rgba(15, 23, 42, .08);
}

.category-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: .7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 110, 253, .1);
    color: var(--sec-blue);
    font-size: 1.2rem;
}

.plan-badge { font-weight: 600; }
.plan-basico { background: #e2e8f0; color: #334155; }
.plan-profesional { background: #dbeafe; color: #1d4ed8; }
.plan-premium { background: #fef3c7; color: #b45309; }

.company-card-premium {
    border-color: #f5d78a;
    box-shadow: 0 10px 24px rgba(180, 83, 9, .08);
}

.stars { color: #f5b301; letter-spacing: .08em; }
.stars-meta { color: var(--sec-muted); font-size: .85rem; margin-left: .4rem; }

.star-picker {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: .15rem;
}
.star-picker input { position: absolute; opacity: 0; pointer-events: none; }
.star-picker label { color: #d1d5db; cursor: pointer; font-size: 1.45rem; line-height: 1; }
.star-picker label:hover,
.star-picker label:hover ~ label,
.star-picker input:checked ~ label { color: #f5b301; }

.aviso-comment:last-child { padding-bottom: 0 !important; }

.listing-thumb,
.news-thumb {
    display: block;
    aspect-ratio: 4 / 3;
    background: #eef2f7;
    overflow: hidden;
}

.news-thumb { aspect-ratio: 16 / 9; }

.listing-thumb img,
.news-thumb img,
.news-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-cover {
    display: block;
    max-height: 460px;
    background: #0a2540;
}

.listing-card-featured {
    border-color: #f5d78a;
    box-shadow: 0 10px 24px rgba(180, 83, 9, .08);
}

.aviso-gallery-main {
    width: 100%;
    max-height: 460px;
    object-fit: contain;
    background: #0a2540;
}

.aviso-gallery-thumbs {
    display: flex;
    gap: .5rem;
    padding: .75rem;
    overflow-x: auto;
}

.aviso-gallery-thumb {
    border: 2px solid transparent;
    padding: 0;
    background: #eef2f7;
    border-radius: .4rem;
    overflow: hidden;
    width: 76px;
    height: 56px;
    flex: 0 0 auto;
}

.aviso-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.aviso-gallery-thumb:hover,
.aviso-gallery-thumb.is-active {
    border-color: var(--sec-blue);
}

.publish-panel {
    background: #fff;
    border: 1px solid var(--sec-border);
    box-shadow: 0 16px 40px rgba(15, 23, 42, .06);
}

.plan-teaser {
    border: 1px solid var(--sec-border);
    border-radius: 1rem;
}

.plan-price {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--sec-navy);
}

.plan-teaser-premium {
    background: linear-gradient(160deg, #0a2540, #084298);
    border: 0;
    color: #fff;
}

.plan-teaser-premium .plan-price,
.plan-teaser-premium h3,
.plan-teaser-premium .small {
    color: #fff;
}

.plan-teaser-premium ul {
    color: rgba(255,255,255,.78);
}

.cta-panel {
    background: linear-gradient(160deg, #0a2540, #084298);
}

.page-header {
    background: linear-gradient(135deg, #07192e 0%, #0a2540 50%, #084298 100%);
    color: #fff;
}

.page-header .text-secondary { color: rgba(255,255,255,.75) !important; }

.auth-wrap {
    min-height: 60vh;
    background: var(--sec-sand);
}

.content-body img,
.content-body iframe { max-width: 100%; height: auto; }

.content-body figure {
    margin: 1.25rem 0;
}

.content-body figure img {
    border-radius: .5rem;
}

.content-body figcaption {
    font-size: .875rem;
    color: #64748b;
    margin-top: .35rem;
}

.news-featured-preview {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: .5rem;
    background: #eef2f7;
}

.content-body p,
.content-body ul,
.content-body ol,
.content-body blockquote {
    margin-bottom: 1rem;
}

.content-body h1,
.content-body h2,
.content-body h3,
.content-body h4 {
    margin: 1.25rem 0 .65rem;
    font-weight: 700;
    line-height: 1.25;
}

.content-body h1 { font-size: 1.45rem; }
.content-body h2 { font-size: 1.3rem; }
.content-body h3 { font-size: 1.15rem; }

.content-body ul,
.content-body ol {
    padding-left: 1.3rem;
}

.content-body li { margin-bottom: .35rem; }

.content-body a { text-decoration: underline; }

.site-footer {
    background: #0b1220;
}

.account-nav .nav-link {
    border-radius: .6rem;
    color: #334155;
    font-weight: 600;
}

.account-nav .nav-link.active,
.account-nav .nav-link:hover {
    background: rgba(13, 110, 253, .1);
    color: var(--sec-blue);
}

.admin-shell { min-height: 100vh; background: #f3f6fb; }
.admin-sidebar {
    width: 260px;
    background: #0a2540;
    color: #fff;
    flex-shrink: 0;
}
.admin-sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem 1rem;
}
.admin-brand {
    display: flex;
    align-items: center;
    min-width: 0;
}
.admin-brand img { height: 43px; width: auto; }
.admin-toggler {
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: .55rem;
    background: transparent;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    padding: 0;
}
.admin-toggler:hover,
.admin-toggler:focus-visible,
.admin-toggler[aria-expanded="true"] {
    background: rgba(255,255,255,.1);
    color: #fff;
}
.admin-nav {
    display: grid;
    gap: .25rem;
    padding: 0 1rem 1rem;
}
.admin-sidebar a {
    color: rgba(255,255,255,.78);
    text-decoration: none;
    display: flex;
    gap: .65rem;
    align-items: center;
    padding: .7rem 1rem;
    border-radius: .55rem;
}
.admin-sidebar a:hover,
.admin-sidebar a.active,
.admin-sidebar .logout-form button:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}
.admin-sidebar .logout-form { display: block; }
.admin-sidebar .logout-form button {
    color: rgba(255,255,255,.78);
    display: flex;
    gap: .65rem;
    align-items: center;
    width: 100%;
    padding: .7rem 1rem;
    border-radius: .55rem;
    text-align: left;
}
.admin-main { min-width: 0; }
.admin-topbar {
    background: #fff;
    border-bottom: 1px solid #e6ebf2;
    padding: .85rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.kpi-card {
    border: 0;
    border-radius: .9rem;
    box-shadow: 0 8px 24px rgba(15,23,42,.06);
}

.table thead th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--sec-muted);
}

.password-field {
    position: relative;
}

.password-field .form-control {
    padding-right: 2.75rem;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: .35rem;
    transform: translateY(-50%);
    width: 2.1rem;
    height: 2.1rem;
    border: 0;
    background: transparent;
    color: var(--sec-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .4rem;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--sec-navy);
    background: var(--sec-sand);
}

.password-toggle[aria-pressed="true"] {
    color: var(--sec-blue);
}

.ad-slot {
    max-width: 728px;
    margin: 1.25rem auto;
    overflow: hidden;
    text-align: center;
}
.ad-slot-home,
.ad-slot-listado {
    max-height: 90px;
}
.ad-slot-ficha {
    max-width: 300px;
    max-height: 250px;
    margin-left: auto;
    margin-right: auto;
}
.ad-slot .adsbygoogle,
.ad-slot iframe {
    max-width: 100% !important;
    max-height: inherit !important;
}

@media (min-width: 992px) {
    .admin-sidebar {
        position: sticky;
        top: 0;
        align-self: flex-start;
        min-height: 100vh;
    }
    .admin-nav.collapse {
        display: grid !important;
        height: auto !important;
        visibility: visible;
    }
    .admin-topbar { padding: .85rem 1.5rem; }
}

@media (max-width: 991.98px) {
    .hero-section { min-height: 360px; }
    .admin-sidebar {
        width: 100%;
        position: sticky;
        top: 0;
        z-index: 1030;
    }
    .admin-nav {
        padding-bottom: 1rem;
    }
    .admin-nav.collapse.show,
    .admin-nav.collapsing {
        display: grid;
    }
    .navbar-brand img { height: 41px; }
}
