/* ================================================================
   PORTAL WIFI BIOSNET - CSS MODERNO
   Design System: Gradientes suaves + Glassmorphism + Mobile-First
   ================================================================ */

/* === RESET E VARIÁVEIS CSS === */
:root {
    /* Cores Primárias - Gradiente BiosNET */
    --primary-start: #667eea;
    --primary-end: #764ba2;
    --primary-light: rgba(102, 126, 234, 0.1);
    
    /* Cores de Estado */
    --success: #10b981;
    --success-light: #d1fae5;
    --error: #ef4444;
    --error-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #3b82f6;
    --info-light: #dbeafe;
    
    /* Neutros */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --border: #e5e7eb;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    
    /* Sombras */
    --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);
    
    /* Transições */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Espaçamentos */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    position: relative;
    overflow-x: hidden;
}

/* === ANIMAÇÃO DE FUNDO === */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.background-animation::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: backgroundMove 20s linear infinite;
}

@keyframes backgroundMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    animation: float 15s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

@keyframes float {
    0%, 100% { 
        transform: translate(0, 0) scale(1);
        opacity: 0;
    }
    10% { opacity: 1; }
    90% { opacity: 1; }
    25% { transform: translate(100px, -100px) scale(1.2); }
    50% { transform: translate(-50px, -150px) scale(0.8); }
    75% { transform: translate(150px, -80px) scale(1.1); }
}

/* === CONTAINER PRINCIPAL - GLASSMORPHISM === */
.container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    padding: var(--spacing-2xl);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl), 
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    max-width: 480px;
    width: 100%;
    position: relative;
    z-index: 1;
    animation: slideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

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

/* === LOGO === */
.logo {
    text-align: center;
    font-size: 4rem;
    margin-bottom: var(--spacing-lg);
    animation: logoFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(102, 126, 234, 0.3));
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* === TIPOGRAFIA === */
h1 {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
    font-size: 0.875rem;
    font-weight: 500;
}

/* === INFO BOX === */
.info-box {
    background: linear-gradient(135deg, var(--primary-light), rgba(118, 75, 162, 0.05));
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-xl);
    font-size: 0.875rem;
    border: 1px solid rgba(102, 126, 234, 0.2);
    backdrop-filter: blur(10px);
}

.info-box strong {
    color: var(--primary-start);
    font-weight: 600;
}

/* === TOGGLE BUTTONS - MOBILE-FIRST === */
.toggle-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    padding: 4px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-bottom: var(--spacing-xl);
    border: 1px solid var(--border);
}

.toggle-btn {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    /* Touch-friendly - mínimo 44x44px */
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.toggle-btn:hover:not(.active)::before {
    opacity: 1;
}

.toggle-btn.active {
    background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
    color: white;
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

/* Micro-interação ao clicar */
.toggle-btn:active {
    transform: scale(0.98);
}

/* === FORM GROUPS === */
.form-group {
    margin-bottom: var(--spacing-lg);
}

label {
    display: block;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
}

/* === INPUTS - TOUCH FRIENDLY === */
.input-with-validation {
    position: relative;
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="tel"] {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    padding-right: 3rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    transition: all var(--transition-base);
    background: var(--bg-primary);
    color: var(--text-primary);
    /* Touch-friendly - mínimo 44px */
    min-height: 48px;
    /* Teclado numérico no mobile */
    -webkit-appearance: none;
    appearance: none;
}

/* Teclado numérico automático para CPF/Tel */
input[data-tipo="cpf"],
input[data-tipo="telefone"] {
    inputmode: numeric;
}

input:focus {
    outline: none;
    border-color: var(--primary-start);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: white;
}

/* Estados de validação */
input:invalid:not(:placeholder-shown) {
    border-color: var(--error);
}

input:valid:not(:placeholder-shown) {
    border-color: var(--success);
}

/* === VALIDATION ICON === */
.validation-icon {
    position: absolute;
    right: var(--spacing-md);
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
}

.validation-icon.show {
    opacity: 1;
    animation: bounceIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    0% { transform: translateY(-50%) scale(0); }
    50% { transform: translateY(-50%) scale(1.2); }
    100% { transform: translateY(-50%) scale(1); }
}

/* === INPUT HINT === */
.input-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: var(--spacing-xs);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

/* === MENSAGENS - TOASTS === */
.message {
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid;
}

.message span {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.message.error {
    background: var(--error-light);
    color: var(--error);
    border-color: var(--error);
}

.message.success {
    background: var(--success-light);
    color: var(--success);
    border-color: var(--success);
}

.message.warning {
    background: var(--warning-light);
    color: var(--warning);
    border-color: var(--warning);
}

.message.info {
    background: var(--info-light);
    color: var(--info);
    border-color: var(--info);
}

/* === BOTÃO PRINCIPAL - TOUCH FRIENDLY === */
.btn {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-xl);
    background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    /* Touch-friendly */
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    box-shadow: var(--shadow-md);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn:hover:not(:disabled)::before {
    left: 100%;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* === CHECKBOX === */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.checkbox-group input[type="checkbox"] {
    margin-top: 3px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-start);
}

.checkbox-group label {
    margin: 0;
    font-size: 0.813rem;
    cursor: pointer;
    font-weight: 400;
}

.checkbox-group a {
    color: var(--primary-start);
    text-decoration: none;
    font-weight: 600;
}

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

/* === FOOTER === */
.footer {
    text-align: center;
    margin-top: var(--spacing-xl);
    font-size: 0.813rem;
    color: var(--text-secondary);
}

.footer a {
    color: var(--primary-start);
    text-decoration: none;
    transition: all var(--transition-base);
    font-weight: 500;
}

.footer a:hover {
    text-decoration: underline;
    color: var(--primary-end);
}

/* === LOADING SCREEN === */
.loading-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading-screen.active {
    display: flex;
    animation: fadeIn 0.3s;
}

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

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-xl);
}

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

.loading-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    margin-bottom: var(--spacing-sm);
}

.loading-progress {
    width: 300px;
    max-width: 90vw;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: var(--spacing-lg) auto 0;
}

.loading-progress-bar {
    height: 100%;
    background: white;
    width: 0%;
    transition: width 0.3s ease-out;
    border-radius: var(--radius-full);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* === SKELETON LOADING === */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: var(--spacing-sm);
}

.skeleton-input {
    height: 48px;
    margin-bottom: var(--spacing-md);
}

.skeleton-button {
    height: 52px;
}

/* === FOCUS STATES (ACESSIBILIDADE) === */
*:focus-visible {
    outline: 3px solid var(--primary-start);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

button:focus-visible,
a:focus-visible {
    outline-offset: 4px;
}

/* === MEDIA QUERIES - MOBILE FIRST === */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .container {
        padding: var(--spacing-2xl) 2.5rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .toggle-btn {
        font-size: 0.938rem;
        padding: var(--spacing-md) var(--spacing-xl);
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    body {
        padding: var(--spacing-2xl);
    }
    
    .container {
        max-width: 520px;
    }
    
    .logo {
        font-size: 4.5rem;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .container {
        max-width: 540px;
    }
}

/* === DARK MODE (preparado para futuro) === */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --text-tertiary: #9ca3af;
        --border: #374151;
        --bg-primary: #1f2937;
        --bg-secondary: #111827;
    }
    
    .container {
        background: rgba(31, 41, 55, 0.95);
    }
    
    input[type="text"],
    input[type="email"],
    input[type="date"],
    input[type="tel"] {
        background: var(--bg-secondary);
        border-color: var(--border);
        color: var(--text-primary);
    }
    
    input:focus {
        background: var(--bg-primary);
    }
}

/* === REDUCED MOTION (ACESSIBILIDADE) === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === PRINT STYLES === */
@media print {
    body {
        background: white;
    }
    
    .background-animation,
    .loading-screen,
    .footer {
        display: none !important;
    }
    
    .container {
        box-shadow: none;
        border: 1px solid #000;
    }
}
