/* ========================================
   VARIABLES Y RESET
   ======================================== */
:root {
    /* Light theme variables */
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --background: #f9fafb;
    --white: #ffffff;
    --border: #e5e7eb;
    --error: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --rating-bg: #f9fafb;
}

/* Light theme variables - ensure proper contrast */
:root {
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
}

/* Dark theme variables */
[data-theme="dark"] {
    --text-primary: #ffffff;
    --text-secondary: #d1d5db;
    --text-light: #9ca3af;
    --background: #0f172a;
    --white: #1e293b;
    --border: #374151;
    --card-bg: #1e293b;
    --input-bg: #334155;
    --rating-bg: #0f172a;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s ease;
}

/* Dark mode background */
[data-theme="dark"] body {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

/* ========================================
   CONTAINER Y CARD
   ======================================== */
.container {
    max-width: 700px;
    margin: 0 auto;
    animation: fadeIn 0.6s ease-out;
}

.survey-card {
    background: var(--card-bg);
    border-radius: 24px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: slideUp 0.6s ease-out;
    position: relative;
    transition: all 0.3s ease;
}

/* ========================================
   THEME TOGGLE BUTTON
   ======================================== */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    color: var(--white);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    position: absolute;
    transition: all 0.3s ease;
}

.sun-icon {
    opacity: 1;
    transform: rotate(0deg);
}

.moon-icon {
    opacity: 0;
    transform: rotate(180deg);
}

/* Dark mode styles */
[data-theme="dark"] .sun-icon {
    opacity: 0;
    transform: rotate(180deg);
}

[data-theme="dark"] .moon-icon {
    opacity: 1;
    transform: rotate(0deg);
}

/* ========================================
   HEADER
   ======================================== */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 40px 40px 50px;
    color: var(--white);
    position: relative;
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: var(--white);
    border-radius: 24px 24px 0 0;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.logo-circle {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #ffffff;
}

.subtitle {
    font-size: 16px;
    opacity: 0.95;
    font-weight: 400;
    position: relative;
    z-index: 1;
    color: #ffffff;
}

/* ========================================
   PROGRESS BAR
   ======================================== */
.progress-container {
    height: 4px;
    background: var(--border);
    position: relative;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
}

/* ========================================
   FORM STYLES
   ======================================== */
.survey-form {
    padding: 40px;
}

.form-group {
    margin-bottom: 32px;
}

.form-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Ensure labels are always visible */
[data-theme="light"] .form-label {
    color: #1f2937;
}

[data-theme="dark"] .form-label {
    color: #ffffff;
}

.form-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

/* Ensure descriptions are always visible */
[data-theme="light"] .form-description {
    color: #6b7280;
}

[data-theme="dark"] .form-description {
    color: #d1d5db;
}

.required {
    color: var(--error);
}

.optional {
    color: var(--text-light);
    font-weight: 400;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    transition: all 0.3s ease;
    background: var(--input-bg);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
    color: var(--text-light);
}

.form-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    transition: all 0.3s ease;
    resize: vertical;
    background: var(--input-bg);
}

.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.character-count {
    text-align: right;
    font-size: 13px;
    color: var(--text-light);
    margin-top: 8px;
}

/* ========================================
   RATING STARS
   ======================================== */
.rating-container {
    background: var(--rating-bg);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
}

.stars {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-direction: row-reverse;
    margin-bottom: 16px;
}

.stars input[type="radio"] {
    display: none;
}

.star {
    cursor: pointer;
    width: 52px;
    height: 52px;
    color: #d1d5db;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.star:hover,
.star:hover ~ .star {
    color: var(--accent-color);
    transform: scale(1.15);
}

.stars input[type="radio"]:checked ~ label.star {
    color: var(--accent-color);
    animation: starPulse 0.4s ease;
}

.rating-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    min-height: 28px;
    margin-top: 8px;
}

/* Ensure rating text is always visible */
[data-theme="light"] .rating-text {
    color: #1f2937;
}

[data-theme="dark"] .rating-text {
    color: #ffffff;
}

/* ========================================
   BUTTONS
   ======================================== */
.button-container {
    margin-top: 40px;
}

.submit-button {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    font-family: inherit;
}

.submit-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.submit-button:active {
    transform: translateY(0);
}

.submit-button:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
}

.button-icon {
    transition: transform 0.3s ease;
    color: #ffffff;
    stroke: #ffffff;
}

.submit-button:hover .button-icon {
    transform: translateX(4px);
}

/* ========================================
   SUCCESS MESSAGE
   ======================================== */
.success-message {
    display: none;
    padding: 60px 40px;
    text-align: center;
    animation: fadeInScale 0.5s ease;
}

.success-message.active {
    display: block;
}

.success-icon {
    width: 96px;
    height: 96px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #059669 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    animation: scaleIn 0.5s ease;
}

.success-message h2 {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 16px;
    font-weight: 700;
}

.success-message p {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 32px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.new-survey-button {
    padding: 12px 32px;
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.new-survey-button:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
}

/* ========================================
   LOADING OVERLAY
   ======================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    flex-direction: column;
    gap: 20px;
}

.loading-overlay.active {
    display: flex;
}

.loading-overlay p {
    color: var(--white);
    font-size: 18px;
    font-weight: 500;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
    padding: 24px 40px;
    background: var(--rating-bg);
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.privacy {
    font-size: 12px;
    color: var(--text-light);
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes starPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        max-width: 100%;
    }

    .survey-card {
        border-radius: 16px;
        margin: 0;
    }

    .survey-form {
        padding: 24px;
    }

    .header {
        padding: 32px 24px 40px;
    }

    .title {
        font-size: 24px;
    }

    .logo-circle {
        width: 48px;
        height: 48px;
    }

    .star {
        width: 44px;
        height: 44px;
    }

    .stars {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .rating-container {
        padding: 24px 16px;
    }

    .success-message {
        padding: 40px 24px;
    }

    .footer {
        padding: 20px 24px;
    }

    .form-input, .form-textarea {
        font-size: 16px; /* Previene zoom en iOS */
        padding: 12px 14px;
    }

    .theme-toggle {
        width: 44px;
        height: 44px;
        top: 16px;
        right: 16px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .survey-card {
        border-radius: 12px;
    }

    .header {
        padding: 24px 20px 32px;
    }

    .title {
        font-size: 20px;
    }

    .logo-circle {
        width: 40px;
        height: 40px;
    }

    .star {
        width: 36px;
        height: 36px;
    }

    .stars {
        gap: 4px;
        flex-wrap: wrap;
    }

    .survey-form {
        padding: 20px;
    }

    .rating-container {
        padding: 20px 12px;
    }

    .rating-text {
        font-size: 16px;
    }

    .form-input, .form-textarea {
        padding: 10px 12px;
        font-size: 16px;
    }

    .submit-button {
        padding: 14px 20px;
        font-size: 15px;
    }

    .success-message {
        padding: 30px 20px;
    }

    .success-message h2 {
        font-size: 24px;
    }

    .success-icon {
        width: 80px;
        height: 80px;
    }

    .footer {
        padding: 16px 20px;
        font-size: 13px;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
        top: 12px;
        right: 12px;
    }
}

@media (max-width: 360px) {
    .star {
        width: 32px;
        height: 32px;
    }

    .stars {
        gap: 2px;
    }

    .header {
        padding: 20px 16px 28px;
    }

    .title {
        font-size: 18px;
    }

    .survey-form {
        padding: 16px;
    }

    .rating-container {
        padding: 16px 8px;
    }

    .success-message {
        padding: 24px 16px;
    }

    .footer {
        padding: 12px 16px;
    }
}

/* ========================================
   ORIENTACIÓN LANDSCAPE EN MÓVILES
   ======================================== */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        padding: 5px;
    }

    .header {
        padding: 20px 24px 30px;
    }

    .survey-form {
        padding: 20px;
    }

    .rating-container {
        padding: 16px;
    }

    .stars {
        gap: 6px;
    }

    .star {
        width: 40px;
        height: 40px;
    }
}

/* ========================================
   TABLETS
   ======================================== */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 600px;
    }

    .star {
        width: 48px;
        height: 48px;
    }

    .stars {
        gap: 10px;
    }

    .rating-container {
        padding: 28px;
    }
}

/* ========================================
   PANTALLAS GRANDES
   ======================================== */
@media (min-width: 1200px) {
    .container {
        max-width: 800px;
    }

    .survey-form {
        padding: 48px;
    }

    .header {
        padding: 48px 48px 60px;
    }

    .title {
        font-size: 32px;
    }

    .logo-circle {
        width: 64px;
        height: 64px;
    }

    .star {
        width: 56px;
        height: 56px;
    }

    .stars {
        gap: 16px;
    }

    .rating-container {
        padding: 40px;
    }

    .form-input, .form-textarea {
        padding: 16px 18px;
        font-size: 16px;
    }
}

/* ========================================
   MEJORAS DE ACCESIBILIDAD
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   MODO OSCURO (OPCIONAL)
   ======================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #1a1a1a;
        --white: #2a2a2a;
        --text-primary: #ffffff;
        --text-secondary: #b0b0b0;
        --text-light: #808080;
        --border: #404040;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    body {
        background: white;
    }

    .submit-button,
    .new-survey-button {
        display: none;
    }

    .survey-card {
        box-shadow: none;
    }
}

