/* ============================================
   Waterpik Survey — Frame-based Layout
   Base: 1024×1366, max-width 810px, centrat
   ============================================ */

:root {
    --blue-dark: #1F3D7B;
    --blue-card: #2B4178;
    --gold-start: rgba(221, 180, 73, 1);
    --gold-mid: rgba(247, 226, 80, 1);
    --gold-end: rgba(221, 180, 73, 1);
    --white: #ffffff;
    --radius-card: 28px;
    --radius-input: 18px;
    --frame-max: 810px;
}

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

html, body {
    width: 100%;
    height: 100%;
    background: var(--blue-dark);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* ---- Connection Status (fixed, always on top) ---- */
.connection-status {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 600;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(8px);
    color: #334155;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.connection-status.online .status-dot { background: #10b981; }
.connection-status.offline .status-dot { background: #f59e0b; }
.connection-status.offline .status-text { color: #f59e0b; }

/* #app wrapper — must fill the flex parent */
#app {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* On screens wider than tall (landscape), center vertically */
@media (min-aspect-ratio: 1024/1366) {
    #app {
        align-items: center;
    }
}

/* ============================================
   FRAME — The core container
   Maintains 1024:1366 aspect ratio
   Max 810px wide, centered with dark blue bg
   ============================================ */
.survey-frame {
    position: relative;
    width: 100%;
    max-width: var(--frame-max);
    aspect-ratio: 1024 / 1366;
    overflow: hidden;
    flex-shrink: 0;
}

/* ---- Steps ---- */
.step {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    animation: fadeIn 0.4s ease;
}

.step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* Step backgrounds fill the frame */
.step-fullscreen {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}


/* ============================================
   HOME SCREEN — Matches "nou" mockup exactly
   ============================================ */
#step-home {
    display: none;
}

#step-home.active {
    display: block;
}

.home-product {
    position: absolute;
    left: 5.15%;
    top: 9.64%;
    width: 90.54%;
    height: auto;
    object-fit: contain;
    z-index: 5;
    pointer-events: none;
}

.home-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.home-card {
    position: absolute;
    left: 38%;
    top: 67.2%;
    width: 56.42%;
    height: 18.37%;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: clamp(18px, 2.93vw, 24px);
    border: 2px solid var(--blue-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 4%;
}

.home-card p {
    position: absolute;
    left: 34%;
    top: 14%;
    width: 72%;
    font-size: clamp(20px, 3.2vw, 31px);
    line-height: 1.05;
    color: var(--blue-dark);
    font-weight: 300;
}

.home-card strong {
    font-weight: 800;
}

.btn-empezar {
    position: absolute;
    left: 38%;
    bottom: 14%;
    width: fit-content;
    background: var(--blue-dark);
    color: var(--white);
    border: none;
    border-radius: 50px;
    padding: 3% 8%;
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-size: clamp(18px, 2.8vw, 28px);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.15s ease;
    letter-spacing: 0.02em;
}

.btn-empezar:hover {
    background: #162d5c;
    transform: scale(1.03);
}

.btn-empezar:active {
    transform: scale(0.97);
}

/* Arrow button */
.home-arrow {
    position: absolute;
    left: 87%;
    top: 91.29%;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.btn-arrow {
    background: none;
    border: none;
    font-size: 2.2rem;
    cursor: pointer;
    color: var(--blue-dark);
    transition: transform 0.15s;
    padding: 4px 8px;
    line-height: 1;
}

.btn-arrow:hover {
    transform: translateX(4px);
}

.btn-arrow:active {
    transform: translateX(4px);
}

.btn-arrow-white {
    color: var(--white);
}


/* ============================================
   REGISTER / SKIP SCREENS
   ============================================ */
#step-register,
#step-skip {
    display: none;
}

#step-register.active,
#step-skip.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.register-overlay {
    width: 100%;
    max-width: 85%;
    padding: 5% 4%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3%;
}

.register-card {
    width: 100%;
    background: linear-gradient(90deg, rgba(221, 180, 73, 0.85) 0%, rgba(247, 226, 80, 0.85) 50%, rgba(221, 180, 73, 0.85) 100%);
    border-radius: 44px;
    padding: 6% 6% 5%;
    position: relative;
}

.register-title {
    font-family: 'Inter', sans-serif;
    font-size: clamp(1.4rem, 4vw, 51px);
    font-weight: 800;
    font-style: normal;
    color: var(--blue-dark);
    text-align: center;
    margin-bottom: 5%;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.register-subtitle {
    font-size: clamp(0.9rem, 2vw, 1.05rem);
    color: var(--blue-dark);
    text-align: center;
    margin-bottom: 5%;
    opacity: 0.75;
    line-height: 1.4;
}

.register-field {
    margin-bottom: 3%;
}

.register-field input {
    width: 100%;
    padding: 4% 5%;
    border: none;
    border-radius: var(--radius-input);
    font-family: inherit;
    font-size: clamp(0.9rem, 2vw, 1.05rem);
    color: #333;
    background: var(--white);
    outline: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}

.register-field input:focus {
    box-shadow: 0 0 0 2.5px var(--blue-dark);
}

.register-field input::placeholder {
    color: #aaa;
    font-weight: 400;
}

.register-checks {
    margin-top: 4%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 1%;
}

.register-check {
    display: flex;
    align-items: flex-start;
    gap: 3%;
    cursor: pointer;
    font-size: clamp(0.65rem, 1.5vw, 0.78rem);
    line-height: 1.55;
    color: var(--blue-dark);
}

.register-check input[type="checkbox"] {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    background: var(--white);
    border: 2.5px solid rgba(200,200,200,0.6);
    cursor: pointer;
    position: relative;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: all 0.2s;
}

.register-check input[type="checkbox"]:checked {
    background: var(--blue-dark);
    border-color: var(--blue-dark);
}

.register-check input[type="checkbox"]:checked::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--white);
    font-size: 15px;
    font-weight: 700;
}

.register-check a {
    color: var(--blue-dark);
    text-decoration: underline;
}

.register-check strong {
    font-weight: 700;
}

.register-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 3%;
    padding: 0 2%;
}

.register-nav .btn-arrow {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.register-logo {
    text-align: center;
}

.register-logo img {
    width: 555px;
    max-width: 80%;
    height: auto;
    margin-top: -160px;
}

/* Skip/decision buttons */
.skip-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 5%;
    padding: 0 3%;
    align-items: center;
}

.skip-buttons .btn-empezar {
    position: static;
    width: 100%;
    text-align: center;
    padding: 3% 8%;
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-size: clamp(18px, 2.8vw, 28px);
    font-weight: 700;
    border-radius: 50px;
}

.btn-skip {
    display: inline-block;
    background: transparent;
    color: var(--blue-dark);
    border: 2px solid var(--blue-dark);
    border-radius: 50px;
    width: 100%;
    padding: 3% 8%;
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-size: clamp(18px, 2.8vw, 28px);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s;
    text-align: center;
}

.btn-skip:hover {
    transform: scale(1.03);
}

.btn-skip:active {
    transform: scale(0.97);
}

/* Register submit button (inverse of btn-skip) */
.btn-register-submit {
    display: inline-block;
    background: var(--blue-dark);
    color: var(--white);
    border: 2px solid var(--blue-dark);
    border-radius: 50px;
    width: 100%;
    padding: 3% 8%;
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-size: clamp(18px, 2.8vw, 28px);
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    text-align: center;
    margin-top: 4%;
}

.btn-register-submit:hover {
    background: #162d5c;
    transform: scale(1.03);
}

.btn-register-submit:active {
    transform: scale(0.97);
}

/* Separated wrapper for "no quiero participar" */
.register-skip-wrapper {
    margin-top: 6%;
    text-align: center;
}

.register-skip-wrapper .btn-skip {
    opacity: 0.7;
    font-size: clamp(14px, 2.2vw, 22px);
}

/* Thanks page: "Nueva encuesta" at the bottom */
.btn-restart-skip {
    position: absolute;
    bottom: 60px;
    width: fit-content;
    padding: 2% 6%;
    font-size: clamp(14px, 2vw, 20px);
    font-weight: 700;
    opacity: 1;
}


/* ============================================
   LEGAL PAGES
   ============================================ */
.legal-page {
    background-size: cover;
    background-position: center;
}

.legal-overlay {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 5%;
}

.legal-card {
    background: rgba(43, 65, 120, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-card);
    padding: 6% 6% 5%;
    width: 85%;
    max-height: 75%;
    overflow-y: auto;
}

.legal-title {
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-weight: 800;
    font-size: clamp(1.4rem, 4vw, 42px);
    color: var(--white);
    text-align: center;
    margin-bottom: 5%;
}

.legal-body {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(0.8rem, 2vw, 18px);
    color: var(--white);
    line-height: 1.7;
}

.legal-body p {
    margin-bottom: 1.2em;
}

.legal-body p:last-child {
    margin-bottom: 0;
}

.legal-logo {
    position: absolute;
    bottom: 3%;
    left: 50%;
    transform: translateX(-50%);
    width: 25%;
    max-width: 180px;
}

.legal-logo img {
    width: 100%;
    height: auto;
}

/* Scrollbar styling for legal card */
.legal-card::-webkit-scrollbar {
    width: 6px;
}

.legal-card::-webkit-scrollbar-track {
    background: transparent;
}

.legal-card::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* ============================================
   LEGAL POPUPS
   ============================================ */
.legal-popup {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
}

.legal-popup.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.legal-popup-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.legal-popup-container {
    position: relative;
    background: rgba(31, 61, 123, 0.97);
    border-radius: var(--radius-card);
    width: 88%;
    max-height: 85%;
    padding: 60px 6% 6%;
    overflow-y: auto;
    z-index: 1;
}

.legal-popup-close {
    position: sticky;
    top: -60px;
    float: right;
    margin-top: -45px;
    margin-right: -2%;
    width: 44px;
    height: 44px;
    background: var(--white);
    color: var(--blue-dark);
    border: none;
    border-radius: 50%;
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.legal-popup-close:hover {
    transform: scale(1.1);
}

.legal-popup-title {
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-weight: 800;
    font-size: clamp(1.2rem, 3.5vw, 36px);
    color: var(--white);
    text-align: center;
    margin-bottom: 5%;
}

.legal-popup-body {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(0.75rem, 1.8vw, 16px);
    color: var(--white);
    line-height: 1.7;
}

.legal-popup-body p {
    margin-bottom: 1.2em;
}

.legal-popup-body p:last-child {
    margin-bottom: 0;
}

/* Scrollbar for popup */
.legal-popup-container::-webkit-scrollbar {
    width: 6px;
}

.legal-popup-container::-webkit-scrollbar-track {
    background: transparent;
}

.legal-popup-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.legal-popup-link {
    color: inherit;
}

/* ============================================
   QUESTION SCREENS
   ============================================ */
[id^="step-question-"] {
    display: none;
}

[id^="step-question-"].active {
    display: block;
}

.question-overlay {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Right-side gradient overlay */
.question-gradient {
    position: absolute;
    top: 0;
    right: 0;
    width: 55%;
    height: 100%;
    background: linear-gradient(270deg, rgba(217, 227, 235, 0.9) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Card — positioned center-right area */
.question-card {
    position: absolute;
    z-index: 2;
    background: rgba(43, 65, 120, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-card);
    padding: 5% 4% 4%;
    width: 57%;
    right: 41px;
    top: 180px;
}

.question-title {
    font-family: 'Inter', sans-serif;
    font-size: clamp(1.2rem, 3.5vw, 40px);
    font-weight: 800;
    font-style: normal;
    color: var(--white);
    margin-bottom: 5%;
    line-height: 1.3;
    text-align: center;
}

#step-question-1 .question-title {
    text-transform: uppercase;
    margin-bottom: 12%;
}

#step-question-2 .question-card,
#step-question-3 .question-card,
#step-question-4 .question-card {
    padding-left: 7%;
    padding-right: 7%;
}

#step-question-2 .options-list,
#step-question-3 .options-list,
#step-question-4 .options-list {
    gap: 22px;
}

#step-question-2 .question-nav,
#step-question-3 .question-nav,
#step-question-4 .question-nav {
    margin-right: -45px;
    margin-top: -10px;
}

#step-question-5 .question-nav {
    margin-right: -25px;
    margin-top: -10px;
}

#step-question-2 .question-title,
#step-question-3 .question-title,
#step-question-4 .question-title {
    font-size: clamp(1rem, 2.8vw, 32px);
    margin-bottom: 10%;
}

#step-question-4 .question-title,
#step-question-5 .question-title {
    font-size: clamp(0.9rem, 2.2vw, 26px);
}

/* Options (radio buttons as rounded white squares) */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
}

.options-horizontal {
    flex-direction: row;
    gap: 24px;
    justify-content: center;
}

.option-pill {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.option-pill input {
    display: none;
}

.option-pill-dot {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 10px;
    background: var(--white);
    transition: all 0.2s;
    position: relative;
    flex-shrink: 0;
}

.option-pill input:checked + .option-pill-dot {
    background: var(--blue-card);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.option-pill input:checked + .option-pill-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 5px;
    background: var(--white);
}

.option-pill-text {
    font-size: clamp(1.05rem, 2.5vw, 1.35rem);
    color: var(--white);
    font-weight: 500;
    line-height: 1.3;
}

/* Rating stars */
.rating-container {
    text-align: center;
}

.rating-stars {
    display: flex;
    justify-content: space-between;
    gap: 2px;
    margin-bottom: 4px;
}

.rating-star {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.4);
    transition: color 0.15s, transform 0.1s;
}

.rating-star svg {
    width: clamp(18px, 3vw, 26px);
    height: clamp(18px, 3vw, 26px);
    display: block;
}

.rating-star.active {
    color: var(--white);
}

.rating-star.active svg {
    fill: var(--white);
}

.rating-star:active {
    transform: scale(1.15);
}

.rating-numbers {
    display: flex;
    justify-content: space-between;
    gap: 2px;
    margin-bottom: 8px;
}

.rating-numbers span {
    width: 26px;
    text-align: center;
    font-size: clamp(0.7rem, 1.5vw, 0.85rem);
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

.rating-hint {
    font-size: clamp(0.7rem, 1.5vw, 0.85rem);
    color: rgba(255, 255, 255, 0.55);
    margin-top: 2px;
}

/* Question navigation arrow */
.question-nav {
    display: flex;
    justify-content: flex-end;
    margin-top: -20px;
    margin-bottom: -25px;
    margin-right: -20px;
}

.question-nav .btn-arrow {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Logo — bottom-right absolute */
.question-logo {
    position: absolute;
    bottom: 0%;
    right: 0%;
    z-index: 2;
    text-align: right;
}

.question-logo img {
    width: 555px;
    max-width: 80%;
    height: auto;
}


/* ============================================
   THANKS SCREEN
   ============================================ */
#step-thanks {
    display: none;
}

#step-thanks.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.thanks-overlay {
    width: 85%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.thanks-card {
    background: rgba(43, 65, 120, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-card);
    padding: 8% 6% 10%;
    text-align: center;
    position: relative;
    width: 100%;
    overflow: visible;
}

.thanks-title {
    font-family: 'Inter', sans-serif;
    font-size: clamp(1.6rem, 4.5vw, 50px);
    font-weight: 800;
    font-style: normal;
    color: var(--white);
    line-height: 1.08;
    margin-bottom: 4%;
    letter-spacing: -0.02em;
}

.thanks-text {
    font-family: 'Inter', sans-serif;
    font-size: clamp(0.95rem, 2.3vw, 24px);
    font-weight: 500;
    font-style: normal;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
    padding: 0 3%;
}

.thanks-text strong {
    color: var(--white);
    font-weight: 700;
}

.thanks-emoji {
    position: absolute;
    bottom: -70px;
    right: -40px;
    width: 95px;
    height: auto;
    pointer-events: none;
}

#step-thanks .btn-restart {
    position: static;
    margin-top: 6%;
    background: var(--white);
    color: var(--blue-dark);
    width: fit-content;
    padding: 3% 8%;
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-size: clamp(18px, 2.8vw, 28px);
    font-weight: 700;
    border-radius: 50px;
}


/* ============================================
   ADMIN LOGIN (outside the frame)
   ============================================ */
.admin-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f4fd 100%);
}

.login-card {
    background: var(--white);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h1 {
    font-size: 1.3rem;
    color: #0f172a;
    margin-bottom: 4px;
}

.login-card p {
    color: #94a3b8;
    font-size: 0.85rem;
    margin-bottom: 24px;
}

.login-card .form-group {
    text-align: left;
    margin-bottom: 20px;
}

.login-card .form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.login-card .form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    color: #0f172a;
}

.login-card .form-group input:focus {
    outline: none;
    border-color: #0066B3;
}

.login-card .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    background: #0066B3;
    color: var(--white);
    margin-top: 8px;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.85rem;
}

.alert-error {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
}
