/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #63b3ed;
    --primary-light: #b2f7ef;
    --text-primary: #2a4365;
    --text-secondary: #4a5568;
    --border-color: #e3e8ee;
    --background-light: #f7fafc;
    --success-bg: linear-gradient(90deg, #e6fffa 0%, #bee3f8 100%);
    --error-bg: linear-gradient(90deg, #fff5f5 0%, #bee3f8 100%);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f7fafc 0%, #e3e8ee 100%);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow-x: hidden;
    line-height: 1.5;
    color: var(--text-primary);
}

.container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 1rem;
    z-index: 1;
}

.form-card {
    background: #fff;
    border-radius: 1.125rem;
    padding: 2.5rem 2rem;
    box-shadow: 0 8px 32px 0 rgba(60, 80, 180, 0.08), 0 1.5px 6px 0 rgba(0,0,0,0.04);
    border: 1.5px solid var(--border-color);
    position: relative;
    overflow: hidden;
    width: 100%;
}

.header {
    text-align: center;
    margin-bottom: 2.25rem;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.625rem;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.header p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 1.375rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    letter-spacing: 0.1px;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.125rem;
    border: 1.5px solid var(--border-color);
    border-radius: 0.625rem;
    background: var(--background-light);
}

.option-row .option-text {
    display: flex;
    flex-direction: column;
}

.option-row .option-title {
    font-weight: 600;
    color: var(--text-primary);
}

.option-row .option-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Toggle switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 30px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #e2e8f0;
    transition: .2s;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 24px; width: 24px;
    left: 3px; top: 3px;
    background-color: #fff;
    transition: .2s;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.toggle input:checked + .slider {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-light) 100%);
}

.toggle input:checked + .slider:before {
    transform: translateX(22px);
}

/* Compact on small screens */
@media (max-width: 480px) {
    .option-row { padding: 0.875rem 0.875rem; }
}

/* Footer link styles */
.footer-note {
    margin-top: 0.75rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.text-link {
    color: var(--text-primary);
    text-decoration: underline;
    font-weight: 500;
    cursor: pointer;
}

.text-link:hover { opacity: 0.85; }

.form-group input,
.form-group select {
    padding: 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: 0.625rem;
    font-size: 1rem;
    background: var(--background-light);
    color: var(--text-primary);
    transition: all 0.2s cubic-bezier(.4,2,.6,1);
    box-shadow: 0 1.5px 6px 0 #e3e8ee33;
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 0 0 2px #63b3ed33;
}

.form-group small {
    font-size: 0.85rem;
    color: var(--primary-color);
    margin-top: 0.25rem;
    line-height: 1.4;
}

.submit-btn {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--text-primary);
    border: none;
    padding: 1rem;
    border-radius: 0.625rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(.4,2,.6,1);
    box-shadow: 0 2px 12px 0 #63b3ed22;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
}

.submit-btn:hover,
.submit-btn:focus {
    background: linear-gradient(90deg, var(--primary-light) 0%, var(--primary-color) 100%);
    transform: translateY(-1.5px) scale(1.02);
    box-shadow: 0 6px 18px #63b3ed33;
}

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

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.message {
    margin-top: 1.125rem;
    padding: 1rem;
    border-radius: 0.625rem;
    font-weight: 600;
    text-align: center;
    font-size: 1rem;
    letter-spacing: 0.1px;
    line-height: 1.5;
}

.message.success {
    background: var(--success-bg);
    color: #22543d;
    border: 1px solid #81e6d9;
    box-shadow: 0 1.5px 6px #b2f7ef33;
}

.message.error {
    background: var(--error-bg);
    color: #742a2a;
    border: 1px solid #feb2b2;
    box-shadow: 0 1.5px 6px #fed7d755;
}

.btn-loading {
    display: inline-block;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Responsive Design */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }
    
    .form-card {
        padding: 1.75rem 1.5rem;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .form-group input,
    .form-group select {
        padding: 0.875rem;
        font-size: 0.95rem;
    }
    
    .submit-btn {
        padding: 0.875rem;
        font-size: 1.05rem;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    body {
        padding: 0.5rem;
    }
    
    .container {
        padding: 0.5rem;
    }
    
    .form-card {
        padding: 1.5rem 1.25rem;
        border-radius: 1rem;
    }
    
    .header {
        margin-bottom: 1.75rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .form {
        gap: 1.25rem;
    }
    
    .form-group input,
    .form-group select {
        padding: 0.8125rem;
        font-size: 0.9375rem;
    }
    
    .form-group small {
        font-size: 0.8125rem;
    }
    
    .submit-btn {
        padding: 0.8125rem;
        font-size: 1rem;
    }
    
    .message {
        margin-top: 1rem;
        padding: 0.875rem;
        font-size: 0.9375rem;
    }
}

/* Extra small devices (phones, 360px and down) */
@media (max-width: 360px) {
    html {
        font-size: 13px;
    }
    
    .form-card {
        padding: 1.25rem 1rem;
        border-radius: 0.875rem;
    }
    
    .header h1 {
        font-size: 1.375rem;
    }
    
    .form-group input,
    .form-group select {
        padding: 0.75rem;
    }
    
    .submit-btn {
        padding: 0.75rem;
    }
}

/* Landscape mode for mobile devices */
@media (max-height: 480px) and (orientation: landscape) {
    body {
        padding: 0.5rem 0;
        min-height: 100vh;
        height: auto;
    }
    
    .container {
        padding: 0.5rem;
    }
    
    .form-card {
        padding: 1.25rem;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    body {
        min-height: -webkit-fill-available;
    }
    
    input, select, textarea, button {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }
}

/* Android Chrome address bar fix */
@media (max-height: 600px) and (orientation: portrait) {
    body {
        min-height: 100vh;
        min-height: -webkit-fill-available;
        min-height: fill-available;
    }
}

/* Estilos para la sección de desuscripción */
.unsubscribe-section {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.unsubscribe-section h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.unsubscribe-section p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.unsubscribe-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.unsubscribe-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.unsubscribe-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.2);
}

.unsubscribe-btn {
    background-color: #e53e3e;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0 1.25rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.unsubscribe-btn:hover {
    background-color: #c53030;
}

.unsubscribe-btn:disabled {
    background-color: #cbd5e0;
    cursor: not-allowed;
}

.unsubscribe-message {
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.unsubscribe-message.success {
    background-color: #f0fff4;
    color: #2f855a;
    border: 1px solid #c6f6d5;
}

.unsubscribe-message.error {
    background-color: #fff5f5;
    color: #c53030;
    border: 1px solid #fed7d7;
}

/* Badge */
.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    color: #234e52;
    background: #c6f6d5;
    border: 1px solid #9ae6b4;
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    margin-left: 0.5rem;
    vertical-align: middle;
}