/* Variables CSS - Tema Morado */
:root {
    --primary-color: #8B5CF6;
    --primary-hover: #7C3AED;
    --primary-light: #A78BFA;
    --secondary-color: #EC4899;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --background-color: #F8FAFC;
    --card-background: #ffffff;
    --border-color: #E2E8F0;
    --border-radius: 12px;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);
    --shadow-purple: 0 10px 25px rgba(139, 92, 246, 0.3);
    --gradient-primary: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gradient-primary);
    min-height: 100vh;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    width: 100%;
    max-width: 100vw;
}

body::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 100vh;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
    pointer-events: none;
}

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

/* Container principal */
.auth-container {
    width: 100%;
    max-width: 500px;
    margin: auto;
    position: relative;
    z-index: 1;
}

/* Tarjeta de autenticación */
.auth-card {
    background: var(--card-background);
    border-radius: 20px;
    box-shadow: var(--shadow-purple);
    padding: 2rem;
    margin: 0;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: fadeInUp 0.6s ease-out;
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
    max-width: 500px;
}

/* Scrollbar personalizado */
.auth-card::-webkit-scrollbar {
    width: 6px;
}

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

.auth-card::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 10px;
}

.auth-card::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

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

/* Header */
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.logo i {
    font-size: 2rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.helper-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: center;
    margin-top: 0.5rem;
}

/* Formulario */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.auth-form.compact {
    gap: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-group label i {
    color: var(--primary-color);
    width: 16px;
}

/* Inputs */
.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: var(--card-background);
}

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

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

/* Password input con toggle */
.password-input {
    position: relative;
    width: 100%;
}

.password-input input {
    width: 100%;
    padding-right: 2.5rem;
}

.form-footer {
    display: flex;
    justify-content: center;
    margin-top: -10px;
    margin-bottom: 10px;
}

.toggle-password {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.toggle-password:hover {
    color: var(--primary-color);
}

/* Password strength */
.password-strength {
    height: 4px;
    border-radius: 2px;
    margin-top: 0.25rem;
    transition: all 0.3s ease;
}

.password-strength.weak {
    background: var(--error-color);
    width: 33%;
}

.password-strength.medium {
    background: var(--warning-color);
    width: 66%;
}

.password-strength.strong {
    background: var(--success-color);
    width: 100%;
}

/* Opciones del formulario */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Checkbox personalizado */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.checkbox-container input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-container input:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-container input:checked + .checkmark::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
}

/* Enlaces */
.forgot-password {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.forgot-password:hover {
    color: var(--primary-hover);
}

/* Botones */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-purple);
    position: relative;
    overflow: hidden;
}

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

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(139, 92, 246, 0.4);
}

.btn-primary:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(139, 92, 246, 0.06);
}

/* Footer */
.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.auth-footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    color: var(--primary-hover);
}

/* Demo credentials */
.demo-credentials {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-top: 1.5rem;
}

.demo-credentials h4 {
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.demo-item {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: monospace;
    background: white;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

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

.loading-spinner {
    background: var(--card-background);
    padding: 2rem;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.loading-spinner i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.loading-spinner p {
    color: var(--text-secondary);
    margin: 0;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    min-width: 300px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--error-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

.toast.info {
    border-left: 4px solid var(--primary-color);
}

.toast-icon {
    font-size: 1.25rem;
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: var(--error-color);
}

.toast.warning .toast-icon {
    color: var(--warning-color);
}

.toast.info .toast-icon {
    color: var(--primary-color);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.5rem;
        align-items: center;
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    .auth-container {
        max-width: 100%;
        width: 100%;
        overflow-x: hidden;
    }
    
    .auth-card {
        margin: 0;
        padding: 1.5rem;
        border-radius: 16px;
        max-height: 85vh;
        width: 100%;
        overflow-x: hidden;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .logo i {
        font-size: 2rem;
    }
    
    .auth-header h2 {
        font-size: 1.25rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .form-group {
        gap: 0.5rem;
    }
    
    .form-group input,
    .form-group select {
        padding: 0.875rem;
        font-size: 1rem;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    
    .toast {
        min-width: auto;
        width: calc(100vw - 2rem);
        margin: 0 1rem;
    }
    
    .demo-credentials {
        padding: 0.875rem;
        font-size: 0.8rem;
    }
    
    .demo-item {
        font-size: 0.7rem;
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.75rem 0.5rem;
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    .auth-card {
        padding: 1.25rem;
        margin: 0;
        max-height: 80vh;
        width: 100%;
        overflow-x: hidden;
    }
    
    .logo h1 {
        font-size: 1.25rem;
    }
    
    .auth-header {
        margin-bottom: 1.5rem;
    }
    
    .auth-header h2 {
        font-size: 1.125rem;
    }
    
    .auth-header p {
        font-size: 0.8rem;
    }
    
    .form-group label {
        font-size: 0.8rem;
    }
    
    .form-group input,
    .form-group select {
        padding: 0.75rem;
        font-size: 0.95rem;
    }
    
    .checkbox-container {
        font-size: 0.8rem;
    }
    
    .auth-footer {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }
}
