/* styles.css — Calculadora LOPD+IA NeuralV */

:root {
    --primary-color: #006bf0;
    --primary-light: #4A90E2;
    --primary-dark: #003B95;
    --text-dark: #1F2937;
    --text-light: #6B7280;
    --bg-white: #FFFFFF;
    --bg-light: #F8FAFC;
    --border-color: #E2E8F0;
    --success-color: #10B981; /* Green LOPD success */
    --warning-color: #F59E0B; /* Orange LOPD warning */
    --danger-color: #EF4444; /* Red LOPD danger */
    --font-main: 'Montserrat', sans-serif;
    --shadow-sm: 0 1px 3px 0 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.03);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-blue: 0 4px 14px rgba(0, 107, 240, 0.25);
    --transition: all 0.25s ease;
}

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

body {
    font-family: var(--font-main);
    color: var(--text-dark);
    background-color: var(--bg-light);
    line-height: 1.5;
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.page {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Header */
.navbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
    z-index: 1000;
    flex-shrink: 0;
}

.container {
    max-width: 700px; /* Reduced for single column layout */
    margin: 0 auto;
    padding: 0 1.25rem;
    width: 100%;
}

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

.logo-img {
    height: 45px;
    display: block;
}

.btn-nav {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    background-color: var(--primary-color);
    border: 1px solid var(--primary-color);
    color: white;
}

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

/* Main Section */
.hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 0;
    /* Sin overflow:hidden — con el formulario más largo (8 sectores + campos) cortaba el título
       cuando la ventana era baja. Mejor dejar que la página haga scroll si no cabe (fix 2026-07-08). */
}

.hero-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.hero-header {
    text-align: center;
}

.badge-urgency {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.hero-title {
    font-size: clamp(1.4rem, 3.5vw, 1.8rem);
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-dark);
}

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

/* Card / Wizard Container */
.calculator-card {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    width: 100%;
    max-height: calc(100vh - 170px); /* Limit card height to fit screen */
    display: flex;
    flex-direction: column;
}

.calculator-card h2 {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    color: var(--text-dark);
}

.calculator-card .subtitle {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

/* Progress Bar */
.progress-container {
    background: #E2E8F0;
    border-radius: 999px;
    height: 4px;
    width: 100%;
    margin-bottom: 1.25rem;
    overflow: hidden;
    flex-shrink: 0;
}

.progress-bar {
    background: var(--primary-color);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

/* Steps Wrapper for scrolling inside card if content is big */
.step-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    margin-bottom: 1rem;
}

/* Custom scrollbar for steps */
.step-container::-webkit-scrollbar {
    width: 4px;
}
.step-container::-webkit-scrollbar-track {
    background: transparent;
}
.step-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.step {
    display: none;
}

.step.active {
    display: block;
    animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.question-text {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-dark);
    line-height: 1.4;
}

/* Options */
.options-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.option-btn {
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--bg-white);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    text-align: left;
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.option-btn:hover {
    border-color: var(--primary-color);
    background-color: rgba(0, 107, 240, 0.02);
}

.option-btn.selected {
    border-color: var(--primary-color);
    background-color: rgba(0, 107, 240, 0.05);
}

.option-btn i {
    color: var(--primary-color);
    font-size: 1rem;
    opacity: 0;
    transition: var(--transition);
}

.option-btn.selected i {
    opacity: 1;
}

/* Multi-select Grid */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.option-chip {
    padding: 0.75rem 0.5rem;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-white);
    font-family: var(--font-main);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
    color: var(--text-dark);
}

.option-chip:hover {
    border-color: var(--primary-color);
    background-color: rgba(0, 107, 240, 0.02);
}

.option-chip.selected {
    border-color: var(--primary-color);
    background-color: rgba(0, 107, 240, 0.05);
    color: var(--primary-color);
}

/* Form */
.form-group {
    margin-bottom: 0.85rem;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.3rem;
}

.form-group label span {
    color: var(--danger-color);
}

.form-input {
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    font-family: var(--font-main);
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 107, 240, 0.05);
}

.form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    margin-top: 0.75rem;
    cursor: pointer;
    font-size: 0.7rem;
    color: var(--text-light);
    line-height: 1.3;
}

.form-checkbox input {
    margin-top: 1px;
}

.form-checkbox a {
    color: var(--primary-color);
    text-decoration: none;
}

.form-checkbox a:hover {
    text-decoration: underline;
}

.form-error {
    display: none;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 6px;
    padding: 0.6rem 0.85rem;
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
}

/* Nav Buttons inside card */
.step-nav {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.5rem;
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.btn {
    padding: 0.7rem 1.25rem;
    border-radius: 8px;
    font-weight: 700;
    font-family: var(--font-main);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-blue);
    flex: 1;
}

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

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-light);
    border: 1.5px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-light);
    color: var(--text-dark);
}

.btn-full {
    width: 100%;
}

/* Results Section inside Card */
.results-container {
    display: none;
    height: 100%;
    overflow-y: auto;
}

.results-container.active {
    display: block;
    animation: fadeIn 0.4s ease-out forwards;
}

/* CTA fijo a la VENTANA (no al recuadro) — 100% garantizado siempre visible, sin depender de qué scroll
   (de página o de recuadro) esté activo (fix 2026-07-08, "sticky" dentro del recuadro no bastaba) */
.cta-sticky-wrap {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 100%;
    max-width: 700px;
    z-index: 100;
    background: var(--bg-white);
    padding: 0.75rem 1.25rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 16px -8px rgba(0, 0, 0, 0.18);
}

/* Hueco para que el CTA fijo no tape el contenido final (banner de compartir) */
.results-container {
    padding-bottom: 6rem;
}

.results-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 1.25rem;
}

/* Gauge */
.gauge-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 0.75rem;
}

.gauge-svg {
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: #E2E8F0;
    stroke-width: 8;
    transition: stroke 0.3s;
}

.gauge-fill {
    fill: none;
    stroke: var(--danger-color);
    stroke-width: 8;
    stroke-dasharray: 440;
    stroke-dashoffset: 440;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.1, 0.8, 0.2, 1), stroke 0.3s;
    stroke-linecap: round;
}

.gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-dark);
}

.gauge-pct {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-light);
}

.badge-risk {
    display: inline-block;
    padding: 0.35rem 1rem;
    border-radius: 20px;
    font-weight: 800;
    font-size: 0.75rem;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.badge-risk.danger { background-color: var(--danger-color); }
.badge-risk.warning { background-color: var(--warning-color); }
.badge-risk.success { background-color: var(--success-color); }

.risk-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 0.2rem;
}

.risk-fine {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--danger-color);
}

.risk-goal {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 0.35rem;
}

/* Escala visual: qué significa el % y cuál es la meta (feedback Juanan 2026-07-08) */
.risk-scale {
    width: 100%;
    max-width: 320px;
    margin: 0.75rem auto 0;
}

.risk-scale-bar {
    display: flex;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
}

.risk-scale-seg { flex: 1; }
.risk-scale-danger { background: var(--danger-color); }
.risk-scale-warning { background: var(--warning-color); }
.risk-scale-success { background: var(--success-color); }

.risk-scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-light);
    margin-top: 0.2rem;
}

.risk-scale-legend {
    font-size: 0.72rem;
    color: var(--text-light);
    text-align: center;
    margin-top: 0.4rem;
}

/* Category Breakdown Grid */
.breakdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.breakdown-card {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.breakdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.breakdown-card i {
    font-size: 0.85rem;
}

.breakdown-card.success i { color: var(--success-color); }
.breakdown-card.warning i { color: var(--warning-color); }
.breakdown-card.danger i { color: var(--danger-color); }

.breakdown-desc {
    font-size: 0.7rem;
    color: var(--text-light);
    line-height: 1.3;
}

/* Article List */
.infractions-section {
    margin-bottom: 1.25rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.infractions-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.infractions-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.infraction-item {
    background: #fff8f8;
    border-left: 3px solid var(--danger-color);
    padding: 0.6rem 0.75rem;
    border-radius: 0 6px 6px 0;
    font-size: 0.75rem;
}

.infraction-item.warning {
    background: #fffbeb;
    border-left-color: var(--warning-color);
}

.infraction-item strong {
    color: var(--text-dark);
}

.infraction-item p {
    color: var(--text-light);
    margin-top: 0.15rem;
    line-height: 1.4;
}

/* Cases Slider/Box */
.cases-box {
    background: #F8FAFC;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.85rem;
    margin-bottom: 1.5rem;
}

.cases-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.cases-body {
    font-size: 0.72rem;
    color: var(--text-light);
    line-height: 1.4;
}

/* Panel de confirmación de auditoría (fix bug formulario vacío) */
.cta-audit-panel {
    position: relative;
    margin-top: 0.75rem;
    padding: 0.9rem;
    border-radius: 10px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
}

.cta-audit-close {
    position: absolute;
    top: 0.5rem;
    right: 0.6rem;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: var(--bg-white);
    color: var(--text-light);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.cta-audit-close:hover {
    background: var(--border-color);
    color: var(--text-dark);
}

.cta-audit-panel label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.4rem;
}

.cta-audit-intro {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
    margin-right: 2.2rem; /* hueco para que la X de cerrar no tape el texto (fix 2026-07-08) */
    font-weight: 600;
}

/* Share Banner (CAP-F1-6) */
.share-banner {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(0,107,240,0.08), rgba(0,107,240,0.02));
    border: 1px solid rgba(0,107,240,0.15);
    text-align: center;
}

.share-banner-text {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.7rem;
}

.share-banner-text i {
    color: var(--primary-color);
}

.share-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-share {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.9rem;
    border-radius: 8px;
    border: none;
    font-family: var(--font-main);
    font-size: 0.78rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: var(--transition);
}

.btn-share:hover { opacity: 0.9; }

.share-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.share-copied-msg {
    margin-top: 0.6rem;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--success-color);
}

.share-copied-msg-warning {
    color: var(--warning-color);
}

.share-copy-fallback {
    display: block;
    width: 100%;
    margin-top: 0.4rem;
    padding: 0.5rem;
    font-size: 0.75rem;
    font-family: var(--font-main);
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    resize: none;
    min-height: 55px;
}

.btn-share-linkedin { background-color: #0A66C2; }
.btn-share-whatsapp { background-color: #25D366; }
.btn-share-instagram { background: linear-gradient(45deg, #F58529, #DD2A7B, #8134AF); }

/* Footer Section */
.footer {
    background: #051223;
    color: #94a3b8;
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Con el CTA fijo visible, el footer necesita hueco extra para no quedar tapado (fix 2026-07-08) */
body.has-fixed-cta .footer {
    padding-bottom: calc(1.5rem + 90px + env(safe-area-inset-bottom, 0px));
}

.footer img {
    height: 30px;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.footer p {
    margin-bottom: 0.25rem;
}

.footer a {
    color: #38bdf8;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 600px) {
    .calculator-card {
        padding: 1.25rem;
        border-radius: 12px;
        max-height: calc(100vh - 140px);
    }
    .options-grid {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }
    .breakdown-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .hero-title {
        font-size: 1.3rem;
    }
}
