/* ──────────────────────────────────────────
   PRECIOLUZ.ES  –  Design System
   ────────────────────────────────────────── */
:root {
    --bg:           #0f172a;
    --surface:      #1e293b;
    --surface2:     #263148;
    --border:       #334155;
    --text:         #f1f5f9;
    --text-muted:   #94a3b8;
    --accent:       #fbbf24;
    --accent-dark:  #d97706;
    --cheap:        #10b981;
    --low:          #34d399;
    --mid:          #fbbf24;
    --high:         #f97316;
    --expensive:    #ef4444;
    --radius:       12px;
    --radius-sm:    8px;
    --shadow:       0 4px 24px rgba(0,0,0,.35);
    --transition:   .2s ease;
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-dark); }

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

h1,h2,h3,h4 { line-height: 1.25; font-weight: 700; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); }
h3 { font-size: 1.2rem; }

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

.main-content { flex: 1; padding-bottom: 3rem; }

/* ── Header ── */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--text) !important;
    font-weight: 800;
    font-size: 1.25rem;
    white-space: nowrap;
}

.logo-icon { font-size: 1.5rem; filter: drop-shadow(0 0 8px #fbbf24); }

.main-nav {
    display: flex;
    gap: .25rem;
    align-items: center;
}

.main-nav a {
    color: var(--text-muted);
    padding: .4rem .8rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 500;
    transition: all var(--transition);
}

.main-nav a:hover, .main-nav a.active {
    color: var(--accent);
    background: rgba(251,191,36,.08);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: .4rem;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
}

/* ── Hero ── */
.hero {
    background: linear-gradient(135deg, var(--surface) 0%, #1a2744 100%);
    border-bottom: 1px solid var(--border);
    padding: 3rem 0 2.5rem;
    text-align: center;
}

.hero-eyebrow {
    color: var(--accent);
    font-size: .85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-bottom: .5rem;
}

.hero h1 { margin-bottom: 1rem; }

.price-now {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 3rem;
    margin: 1.5rem auto;
    position: relative;
}

.price-now .price-value {
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -2px;
}

.price-now .price-unit {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: .25rem;
}

.price-now .price-hora {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: .5rem;
}

.price-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .9rem;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-top: .75rem;
}

.price-badge.cheap     { background: rgba(16,185,129,.15);  color: var(--cheap); }
.price-badge.low       { background: rgba(52,211,153,.12);  color: var(--low); }
.price-badge.mid       { background: rgba(251,191,36,.12);  color: var(--mid); }
.price-badge.high      { background: rgba(249,115,22,.12);  color: var(--high); }
.price-badge.expensive { background: rgba(239,68,68,.12);   color: var(--expensive); }

/* ── Cards ── */
.section { padding: 2.5rem 0; }

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.section-title .icon { font-size: 1.3rem; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    transition: transform var(--transition), border-color var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.card .card-label {
    font-size: .78rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: .5rem;
}

.card .card-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}

.card .card-sub {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .4rem;
}

.card.card-accent { border-color: var(--accent); }
.card.card-cheap  { border-color: var(--cheap); }
.card.card-expensive { border-color: var(--expensive); }

/* ── Chart container ── */
.chart-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    position: relative;
}

.chart-wrap canvas { max-height: 340px; }

/* ── Tabla de horas ── */
.hours-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
}

.hours-table th {
    background: var(--surface2);
    padding: .75rem 1rem;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    text-align: left;
}

.hours-table td {
    padding: .65rem 1rem;
    font-size: .9rem;
    border-top: 1px solid var(--border);
}

.hours-table tr:hover td { background: var(--surface2); }

.price-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: .4rem;
    vertical-align: middle;
}

.price-dot.cheap     { background: var(--cheap); }
.price-dot.low       { background: var(--low); }
.price-dot.mid       { background: var(--mid); }
.price-dot.high      { background: var(--high); }
.price-dot.expensive { background: var(--expensive); }

/* ── Best hours ── */
.best-hours {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .75rem;
}

.best-hour-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
    position: relative;
}

.best-hour-card .bh-rank {
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .07em;
}

.best-hour-card .bh-hora {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--cheap);
    line-height: 1.1;
    margin: .3rem 0;
}

.best-hour-card .bh-price {
    font-size: .85rem;
    color: var(--text-muted);
}

/* ── Blog / Artículos ── */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.article-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    transition: transform var(--transition), border-color var(--transition);
}

.article-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
}

.article-card .ac-date {
    font-size: .75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.article-card h3 { font-size: 1.05rem; }
.article-card h3 a { color: var(--text); }
.article-card h3 a:hover { color: var(--accent); }

.article-card .ac-excerpt {
    font-size: .87rem;
    color: var(--text-muted);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card .ac-more {
    font-size: .82rem;
    font-weight: 600;
    color: var(--accent);
}

/* ── Artículo single ── */
.article-content {
    max-width: 760px;
    margin: 0 auto;
}

.article-content h2 {
    margin: 2rem 0 .8rem;
    color: var(--accent);
    font-size: 1.3rem;
}

.article-content h3 {
    margin: 1.5rem 0 .5rem;
    font-size: 1.1rem;
}

.article-content p { margin-bottom: 1rem; color: var(--text-muted); }
.article-content p strong { color: var(--text); }

.article-content ul, .article-content ol {
    margin: .75rem 0 .75rem 1.5rem;
    color: var(--text-muted);
}

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

/* ── Calendario histórico ── */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: .5rem;
}

.cal-day {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .7rem .5rem;
    text-align: center;
    font-size: .85rem;
    transition: all var(--transition);
    cursor: pointer;
}

.cal-day:hover, .cal-day.active {
    border-color: var(--accent);
    color: var(--accent);
}

.cal-day .cal-date { font-weight: 700; font-size: 1rem; }
.cal-day .cal-avg  { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; }

/* ── Paginación ── */
.pagination {
    display: flex;
    gap: .5rem;
    justify-content: center;
    margin-top: 2rem;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: .9rem;
    color: var(--text-muted);
    background: var(--surface);
    transition: all var(--transition);
}

.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination span.current { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 700; }

/* ── Breadcrumb ── */
.breadcrumb {
    padding: 1rem 0 .5rem;
    font-size: .82rem;
    color: var(--text-muted);
    display: flex;
    gap: .4rem;
    align-items: center;
    flex-wrap: wrap;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { opacity: .5; }

/* ── Admin ── */
.admin-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.admin-nav {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.admin-nav a {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .45rem 1rem;
    font-size: .88rem;
    color: var(--text-muted);
    transition: all var(--transition);
}

.admin-nav a:hover, .admin-nav a.active {
    border-color: var(--accent);
    color: var(--accent);
}

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

.form-group label {
    display: block;
    font-size: .88rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: .4rem;
}

.form-control {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .65rem 1rem;
    color: var(--text);
    font-size: .9rem;
    font-family: inherit;
    transition: border-color var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1.4rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
}
.btn-primary:hover { background: var(--accent-dark); color: var(--bg); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger { background: var(--expensive); color: #fff; }
.btn-danger:hover { background: #c53030; color: #fff; }

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: .9rem;
}

.alert-success { background: rgba(16,185,129,.12); border-left: 3px solid var(--cheap); color: var(--cheap); }
.alert-error   { background: rgba(239,68,68,.12);  border-left: 3px solid var(--expensive); color: var(--expensive); }
.alert-info    { background: rgba(251,191,36,.08);  border-left: 3px solid var(--accent); color: var(--accent); }

/* ── Footer ── */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 3rem 0 1.5rem;
    margin-top: auto;
}

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

.footer-col p, .footer-col li {
    font-size: .88rem;
    color: var(--text-muted);
    margin-top: .6rem;
}

.footer-col h4 {
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
    margin-bottom: .6rem;
}

.footer-col ul { list-style: none; }
.footer-col ul li { padding: .2rem 0; }

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
    text-align: center;
    font-size: .82rem;
    color: var(--text-muted);
}

/* ── Legend ── */
.legend {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: .75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: .3rem;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: .25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: .6rem 1.1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    margin-bottom: -1px;
}

.tab-btn.active, .tab-btn:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .nav-toggle { display: flex; }

    .main-nav {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 1rem;
        gap: .25rem;
    }

    .main-nav.open { display: flex; }
    .main-nav a { padding: .65rem 1rem; }

    .footer-grid { grid-template-columns: 1fr; }

    .price-now { padding: 1.25rem 2rem; }

    .hours-table { font-size: .82rem; }
    .hours-table th, .hours-table td { padding: .5rem .6rem; }
}

@media (max-width: 480px) {
    .card-grid { grid-template-columns: 1fr 1fr; }
    .best-hours { grid-template-columns: 1fr 1fr; }
}
