:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-light: #f9fafb;
    --border-color: #e5e7eb;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    min-height: 100vh;
    min-height: 100svh; /* Soporte móviles modernos */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    -webkit-text-size-adjust: 100%;
}

.onboarding-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 500px; /* Más estrecho en mobile */
    overflow: hidden;
    animation: slideUp 0.4s ease-out;
}

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

.header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem 1.25rem; /* Más compacto para mobile */
    text-align: center;
}

.logo {
    font-size: 1.25rem; /* Más pequeño para mobile */
    font-weight: 700;
    margin-bottom: 0.75rem; /* Reducido */
    animation: fadeIn 0.5s ease-out 0.2s both;
}

.progress-bar {
    background: rgba(255,255,255,0.2);
    height: 5px; /* Más delgado */
    border-radius: 3px;
    margin: 0.75rem 0; /* Reducido */
    animation: fadeIn 0.5s ease-out 0.3s both;
}

.progress-fill {
    background: white;
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 25%;
}

.step-info {
    font-size: 0.8rem; /* Más pequeño para mobile */
    opacity: 0.9;
    animation: fadeIn 0.5s ease-out 0.4s both;
}

.content {
    padding: 1.25rem;
}

/* Optimización de contenido para mobile con botones sticky */
@media (max-width: 768px) {
    .content {
        padding: 1rem 1.25rem 0 1.25rem;
        padding-bottom: 80px; /* Espacio para botones sticky */
    }
}

@media (max-width: 480px) {
    .content {
        padding: 0.875rem 1rem 0 1rem;
        padding-bottom: 70px;
    }
}

.step {
    display: none;
}

.step.active {
    display: block;
    animation: stepFadeIn 0.3s ease;
}

@keyframes stepFadeIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

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

.step-title {
    font-size: 1.25rem; /* Más pequeño para mobile */
    font-weight: 600;
    margin-bottom: 0.375rem; /* Reducido */
    color: var(--text-primary);
}

.step-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem; /* Reducido */
    font-size: 0.875rem; /* Más pequeño */
    line-height: 1.4; /* Más compacto */
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem; /* Reducido */
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem; /* Más pequeño */
}

.form-input {
    width: 100%;
    padding: 1rem 1.125rem; /* Touch-friendly padding */
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px; /* Previene zoom en iOS */
    transition: all 0.2s ease;
    min-height: 48px; /* Touch target mínimo */
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
}

/* Estilos para inputs de contraseña con botón de mostrar/ocultar */
.password-input {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input .form-input {
    padding-right: 2.75rem; /* espacio para el botón */
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.password-toggle:hover {
    color: var(--text-primary);
    background: rgba(0,0,0,0.04);
}

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

.form-input.error {
    border-color: var(--error-color);
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.form-select {
    width: 100%;
    padding: 1rem 1.125rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: white;
    min-height: 48px;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.error-message {
    color: var(--error-color);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.error-message::before {
    content: '!';
    font-size: 0.875rem;
}

.actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 0;
}

.btn {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 52px;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    flex: 1;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    font-weight: 700;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    flex: 0 0 auto;
    min-width: 120px;
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* Optimización de botones para mobile */
@media (max-width: 768px) {
    .actions {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 1rem;
        margin: 1.5rem -1.25rem -1.25rem -1.25rem;
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
        gap: 0.75rem;
    }
    
    .btn {
        min-height: 48px;
        font-size: 0.95rem;
        padding: 0.875rem 1.25rem;
        border-radius: 10px;
    }
    
    .btn-primary {
        background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
        box-shadow: 0 3px 8px rgba(99, 102, 241, 0.25);
        font-weight: 600;
    }
    
    .btn-primary:hover {
        transform: none;
        box-shadow: 0 3px 8px rgba(99, 102, 241, 0.25);
    }
    
    .btn-primary:active {
        transform: scale(0.98);
        box-shadow: 0 1px 4px rgba(99, 102, 241, 0.25);
    }
    
    .btn-secondary {
        min-width: 100px;
        padding: 0.875rem 1rem;
        border-width: 1.5px;
    }
}

/* Optimización específica para pantallas muy pequeñas */
@media (max-width: 480px) {
    .actions {
        margin: 1rem -1rem -1rem -1rem;
        padding: 0.875rem;
        gap: 0.625rem;
    }
    
    .btn {
        font-size: 0.9rem;
        min-height: 46px;
        padding: 0.75rem 1rem;
    }
    
    .btn-secondary {
        min-width: 90px;
        padding: 0.75rem 0.875rem;
    }
}

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

.loading .btn-primary {
    position: relative;
    color: transparent;
}

.loading .btn-primary::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Business Type Grid - Optimizado para mobile */
.business-type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columnas en mobile */
    gap: 1rem;
    margin-bottom: 2rem;
}

.business-type {
    padding: 1.25rem 1rem; /* Más padding para touch */
    border: 2px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 80px; /* Altura mínima para touch */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    -webkit-tap-highlight-color: transparent;
}

.business-type:hover,
.business-type:focus {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.business-type:active {
    transform: translateY(0);
}

.business-type.selected {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.1);
}

.business-type i {
    font-size: 1.75rem; /* Más grande para touch */
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.business-type div {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.timezone-info {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.summary-section {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-item span:first-child {
    font-weight: 500;
    color: var(--text-secondary);
    flex: 0 0 40%;
}

.summary-item span:last-child {
    color: var(--text-primary);
    text-align: right;
    word-break: break-word;
}

/* Optimización especial para el enlace */
.summary-item.url-item {
    flex-direction: column;
    gap: 0.375rem;
    align-items: stretch;
}

.summary-item.url-item span:first-child {
    flex: none;
}

.summary-item.url-item span:last-child {
    text-align: left;
    background: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 500;
    border: 1px solid rgba(99, 102, 241, 0.2);
    word-break: keep-all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Optimización mobile para resumen */
@media (max-width: 768px) {
    .summary-section {
        margin-bottom: 1rem;
        padding: 1.25rem;
    }
    
    .summary-item {
        padding: 0.625rem 0;
        font-size: 0.85rem;
    }
    
    .summary-item span:first-child {
        flex: 0 0 35%;
        font-size: 0.8rem;
    }
    
    .summary-item span:last-child {
        font-size: 0.9rem;
        text-align: left;
    }
    
    /* Enlace optimizado para mobile */
    .summary-item.url-item span:last-child {
        font-size: 0.8rem;
        padding: 0.375rem 0.625rem;
        margin: 0;
        border-radius: 4px;
    }
}

@media (max-width: 480px) {
    .summary-section {
        padding: 1rem;
    }
    
    .summary-item {
        flex-direction: column;
        gap: 0.25rem;
        align-items: flex-start;
        padding: 0.5rem 0;
    }
    
    .summary-item span:first-child {
        flex: none;
        font-size: 0.75rem;
    }
    
    .summary-item span:last-child {
        font-size: 0.85rem;
        width: 100%;
    }
    
    .summary-item.url-item span:last-child {
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
    }
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Extra small devices (hasta 320px) */
@media (max-width: 320px) {
    body {
        padding: 0.375rem;
    }
    
    .header {
        padding: 1rem;
    }
    
    .logo {
        font-size: 1.125rem;
        margin-bottom: 0.5rem;
    }
    
    .content {
        padding: 0.875rem;
    }
    
    .business-type-grid {
        grid-template-columns: 1fr; /* Una columna en pantallas muy pequeñas */
        gap: 0.75rem;
    }
    
    .step-title {
        font-size: 1.125rem;
        margin-bottom: 0.25rem;
    }
    
    .step-description {
        margin-bottom: 1rem;
        font-size: 0.8rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .actions {
        margin-top: 1rem;
    }
}

/* Small devices (321px - 480px) */
@media (min-width: 321px) and (max-width: 480px) {
    .onboarding-container {
        max-width: 420px;
    }
    
    .header {
        padding: 2rem 1.75rem;
    }
    
    .content {
        padding: 1.75rem;
    }
}

/* Medium devices (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .onboarding-container {
        max-width: 550px;
    }
    
    .business-type-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 columnas en tablets */
    }
    
    .header {
        padding: 2.5rem;
    }
    
    .content {
        padding: 2rem;
    }
    
    .step-title {
        font-size: 1.5rem;
    }
    
    .logo {
        font-size: 1.5rem;
    }
}

/* Large devices (769px+) */
@media (min-width: 769px) {
    .onboarding-container {
        max-width: 600px;
    }
    
    .business-type-grid {
        grid-template-columns: repeat(4, 1fr); /* 4 columnas en desktop */
    }
    
    .actions {
        gap: 1.5rem;
    }
    
    .btn {
        font-size: 1.05rem;
    }
}

/* Optimizaciones por altura - CRÍTICAS para mobile */
@media (max-height: 700px) {
    body {
        padding: 0.75rem;
    }
    
    .header {
        padding: 1.25rem 1rem;
    }
    
    .logo {
        font-size: 1.125rem;
        margin-bottom: 0.5rem;
    }
    
    .content {
        padding: 1rem;
    }
    
    .step-description {
        margin-bottom: 1.25rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .actions {
        margin-top: 1.25rem;
    }
}

@media (max-height: 600px) {
    body {
        padding: 0.5rem;
    }
    
    .header {
        padding: 1rem 0.875rem;
    }
    
    .logo {
        font-size: 1rem;
        margin-bottom: 0.375rem;
    }
    
    .step-info {
        font-size: 0.75rem;
    }
    
    .progress-bar {
        height: 4px;
        margin: 0.5rem 0;
    }
    
    .content {
        padding: 0.875rem;
    }
    
    .step-title {
        font-size: 1.125rem;
        margin-bottom: 0.25rem;
    }
    
    .step-description {
        margin-bottom: 1rem;
        font-size: 0.8rem;
    }
    
    .form-group {
        margin-bottom: 0.875rem;
    }
    
    .form-label {
        margin-bottom: 0.375rem;
        font-size: 0.8rem;
    }
    
    .actions {
        margin-top: 1rem;
    }
}

/* Landscape orientation optimizations */
@media (orientation: landscape) and (max-height: 600px) {
    body {
        padding: 0.5rem 1rem;
    }
    
    .header {
        padding: 1rem 1.25rem;
    }
    
    .logo {
        font-size: 1rem;
        margin-bottom: 0.375rem;
    }
    
    .progress-bar {
        margin: 0.5rem 0;
    }
    
    .content {
        padding: 0.875rem 1rem;
    }
    
    .step-description {
        margin-bottom: 1rem;
    }
    
    .business-type-grid {
        gap: 0.75rem;
    }
    
    .business-type {
        padding: 1rem 0.75rem;
        min-height: 70px;
    }
}

/* Forzar light mode - Prevenir dark mode automático */
@media (prefers-color-scheme: dark) {
    body {
        color-scheme: light !important;
    }
    
    .onboarding-container {
        background: white !important;
        color: var(--text-primary) !important;
    }
    
    .form-input, .form-select {
        background-color: white !important;
        border-color: var(--border-color) !important;
        color: var(--text-primary) !important;
    }
    
    .timezone-info, .summary-section {
        background: var(--bg-light) !important;
        color: var(--text-primary) !important;
    }
    
    .business-type {
        background: white !important;
        color: var(--text-primary) !important;
    }
    
    .business-type.selected {
        background: rgba(99, 102, 241, 0.05) !important;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .onboarding-container,
    .logo,
    .progress-bar,
    .step-info,
    .step.active {
        animation: none;
    }
    
    .business-type:hover {
        transform: none;
    }
    
    .btn-primary:active {
        transform: none;
    }
}

/* Focus indicators for keyboard navigation */
.business-type:focus-visible,
.btn:focus-visible,
.form-input:focus-visible,
.form-select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Tooltip para el slug */
.slug-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
    cursor: help;
    margin-left: 0.5rem;
}

.slug-tooltip:hover {
    color: var(--primary-color);
}

.slug-tooltip-content {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 0.5rem;
    padding: 0.75rem;
    background: var(--text-primary);
    color: white;
    border-radius: 8px;
    font-size: 0.8rem;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 1000;
    max-width: 280px;
    white-space: normal;
    line-height: 1.4;
}

.slug-tooltip:hover .slug-tooltip-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.slug-tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 1rem;
    border: 5px solid transparent;
    border-top-color: var(--text-primary);
}

@media (max-width: 768px) {
    .slug-tooltip-content {
        right: -50%;
        max-width: 200px;
        font-size: 0.75rem;
    }
}