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

/* Apple Sign In Modal - Estilos que imitan 99% el diseño de Apple */
.apple-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

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

.apple-modal {
    background: #111111;
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    padding: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid #1a1a1a;
    animation: slideUp 0.3s ease;
    overflow: hidden;
    position: relative;
    margin: 20px;
}

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

.apple-modal-header {
    text-align: center;
    padding: 32px 32px 24px;
    border-bottom: 1px solid #1a1a1a;
}

.apple-logo {
    width: 40px;
    height: 40px;
    margin: 0 auto 24px;
    display: block;
}

.apple-logo svg {
    width: 100%;
    height: 100%;
    fill: #ffffff;
}

.apple-modal-title {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 28px;
    font-weight: 500;
    color: #ffffff;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    line-height: 1.1;
}

.apple-modal-subtitle {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #999;
    font-weight: 400;
    line-height: 1.4;
}

.apple-modal-body {
    padding: 24px 32px 32px;
}

.apple-form-group {
    margin-bottom: 16px;
}

.apple-form-label {
    display: block;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: #999;
    margin-bottom: 6px;
    padding: 0 2px;
}

.apple-form-input {
    width: 100%;
    height: 44px;
    padding: 0 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 17px;
    color: #e5e5e5;
    background: #1a1a1a;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    transition: all 0.2s ease;
    outline: none;
}

.apple-form-input:focus {
    border-color: #2a2a2a;
    background: #222;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.03);
}

.apple-form-input::placeholder {
    color: #666;
}

.apple-modal-footer {
    padding: 16px 32px 24px;
    border-top: 1px solid #1a1a1a;
}

.apple-btn-primary {
    width: 100%;
    height: 44px;
    background: #ffffff;
    color: #0a0a0a;
    border: none;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 16px;
    letter-spacing: -0.2px;
}

.apple-btn-primary:hover {
    background: #e5e5e5;
}

.apple-btn-primary:active {
    background: #d0d0d0;
    transform: scale(0.98);
}

.apple-btn-primary:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
    transform: none;
}

.apple-btn-secondary {
    width: 100%;
    height: 44px;
    background: transparent;
    color: #999;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 17px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
}

.apple-btn-secondary:hover {
    background: #1a1a1a;
    border-color: #2a2a2a;
    color: #e5e5e5;
}

.apple-links {
    margin-top: 16px;
    text-align: center;
}

.apple-link {
    display: inline-block;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #999;
    text-decoration: none;
    margin: 0 8px;
    transition: color 0.2s ease;
}

.apple-link:hover {
    color: #e5e5e5;
    text-decoration: underline;
}

.apple-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 20px;
    transition: all 0.2s ease;
    z-index: 1;
}

.apple-modal-close:hover {
    background: #1a1a1a;
    color: #e5e5e5;
}

.apple-error-message {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 13px;
    color: #d70015;
    margin-top: 8px;
    padding: 0 2px;
    display: none;
}

.apple-error-message.show {
    display: block;
}

/* Estados del modal de Apple */
.apple-modal-verifying {
    text-align: center;
    padding: 48px 32px;
}

.apple-spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.apple-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #1a1a1a;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: appleSpin 0.8s linear infinite;
}

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

.apple-verifying-text {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 17px;
    color: #e5e5e5;
    font-weight: 400;
}

.apple-code-container {
    padding: 24px 32px 32px;
}

.apple-code-title {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 28px;
    font-weight: 600;
    color: #1d1d1f;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    line-height: 1.1;
    text-align: center;
}

.apple-code-subtitle {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #86868b;
    font-weight: 400;
    line-height: 1.4;
    text-align: center;
    margin-bottom: 24px;
}

.apple-code-input-group {
    margin-bottom: 16px;
}

.apple-code-input {
    width: 100%;
    height: 56px;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 36px;
    font-weight: 300;
    color: #e5e5e5;
    background: #1a1a1a;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    transition: all 0.2s ease;
    outline: none;
    text-align: center;
    letter-spacing: 12px;
    font-variant-numeric: tabular-nums;
}

.apple-code-input:focus {
    border-color: #2a2a2a;
    background: #222;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.03);
}

.apple-code-input::placeholder {
    letter-spacing: 6px;
    color: #666;
    font-size: 28px;
}

.apple-code-hint {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 13px;
    color: #999;
    text-align: center;
    margin-top: 8px;
}

.apple-modal-body.hidden {
    display: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: #0a0a0a;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(120, 119, 198, 0.03) 0%, transparent 50%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e5e5e5;
}

.container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #1a1a1a;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-header h1 {
    font-size: 2.5rem;
    margin: 0;
    color: #ffffff;
    letter-spacing: 3px;
    font-weight: 300;
    text-transform: uppercase;
}

.tagline {
    font-size: 0.75rem;
    opacity: 0.5;
    margin: 0;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 400;
}

.login-form {
    background: #111111;
    padding: 40px 32px;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    border: 1px solid #1a1a1a;
}

.login-form h2 {
    text-align: center;
    color: #ffffff;
    margin-bottom: 8px;
    font-size: 1.5rem;
    font-weight: 500;
    letter-spacing: -0.5px;
}

.subtitle {
    text-align: center;
    color: #888;
    margin-bottom: 32px;
    font-size: 0.875rem;
    font-weight: 400;
}

/* Provider selection */
.provider-selection {
    background: transparent;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 16px;
}

.provider-title {
    text-align: center;
    color: #999;
    margin-bottom: 20px;
    font-weight: 400;
    font-size: 0.8125rem;
    letter-spacing: 0.5px;
}

.provider-buttons {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.provider-btn {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    height: 48px;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    padding: 0 18px;
    font-weight: 400;
    font-size: 14px;
    cursor: pointer;
    background: #1a1a1a;
    color: #e5e5e5;
    transition: all 0.2s ease;
}

.provider-btn.apple { color: #e5e5e5; }
.provider-btn.google { color: #e5e5e5; }

.provider-btn:hover {
    background: #222;
    border-color: #2a2a2a;
}

.provider-btn:active {
    background: #1a1a1a;
}

/* OR divider */
.or-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
    margin-bottom: 24px;
    color: #666;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 1px;
}
.or-divider::before,
.or-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #1a1a1a;
}
.or-divider span {
    display: inline-block;
    min-width: 28px;
    text-align: center;
}

.chosen-provider {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 10px 0 16px 0;
    padding: 12px;
    background: #1a1a1a;
    border-radius: 8px;
    border: 1px solid #1a1a1a;
}

.provider-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 400;
    font-size: 0.875rem;
    background: #111;
    color: #999;
    border: 1px solid #1a1a1a;
}

.provider-badge.apple { background: #111; color: #999; border: 1px solid #1a1a1a; }
.provider-badge.google { background: #111; color: #999; border: 1px solid #1a1a1a; }

.change-provider {
    background: transparent;
    border: none;
    color: #666;
    font-weight: 400;
    cursor: pointer;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.change-provider:hover {
    color: #999;
}

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

label {
    display: block;
    margin-bottom: 8px;
    color: #999;
    font-weight: 400;
    font-size: 0.8125rem;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: #1a1a1a;
    color: #e5e5e5;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #2a2a2a;
    background: #222;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.03);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
    color: #666;
}

.btn-submit {
    width: 100%;
    padding: 12px;
    background: #ffffff;
    color: #0a0a0a;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.btn-submit:hover {
    background: #e5e5e5;
}

.btn-submit:active {
    background: #d0d0d0;
}

.message {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 400;
    font-size: 0.875rem;
}

.message.success {
    background: #1a3a1a;
    color: #4ade80;
    border: 1px solid #2a4a2a;
}

.message.error {
    background: #3a1a1a;
    color: #f87171;
    border: 1px solid #4a2a2a;
}

.message.loading {
    background: #1a2a3a;
    color: #60a5fa;
    border: 1px solid #2a3a4a;
    position: relative;
}

.message.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid #0c5460;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

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

/* Spinner Styles */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.spinner-content {
    text-align: center;
    color: #e5e5e5;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #2a2a2a;
    border-top: 3px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.spinner-content p {
    font-size: 14px;
    margin: 0;
    color: #b0b0b0;
    font-weight: 400;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.hidden {
    display: none !important;
}

.modal-content {
    background: #1a1a1a;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid #2a2a2a;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h2 {
    color: #ffffff;
    margin-bottom: 16px;
    font-size: 1.5rem;
    font-weight: 500;
}

.modal-content p {
    color: #b0b0b0;
    margin-bottom: 24px;
    line-height: 1.5;
    font-size: 0.875rem;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-cancel {
    flex: 1;
    padding: 12px;
    background: #2a2a2a;
    color: #e5e5e5;
    border: 1px solid #333;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel:hover {
    background: #333;
    border-color: #404040;
}

/* Estilos para modales de éxito y error */
.success-modal .modal-content {
    border-left: 3px solid #4ade80;
}

.success-modal h2 {
    color: #4ade80;
}

.error-modal .modal-content {
    border-left: 3px solid #f87171;
}

.error-modal h2 {
    color: #f87171;
}

/* Modal de Mantenimiento */
.maintenance-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeIn 0.3s ease;
}

.maintenance-modal {
    background: #111111;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    padding: 48px 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    border: 1px solid #1a1a1a;
    text-align: center;
    margin: 20px;
}

.maintenance-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.maintenance-icon {
    width: 80px;
    height: 80px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.maintenance-title {
    font-size: 2rem;
    font-weight: 500;
    color: #ffffff;
    margin: 0;
    letter-spacing: -0.5px;
}

.maintenance-message {
    font-size: 1rem;
    color: #b0b0b0;
    line-height: 1.6;
    margin: 0;
}

.maintenance-submessage {
    font-size: 0.875rem;
    color: #888;
    margin: 0;
    margin-top: -8px;
}

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 16px;
    }
    
    .login-form {
        padding: 32px 24px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .maintenance-modal {
        padding: 32px 24px;
    }
    
    .maintenance-title {
        font-size: 1.5rem;
    }
}