/**
 * Dr. Servicios - Auth Modal Styles
 * Estilos para el modal de autenticación requerida
 */

/* Modal Overlay */
#auth-required-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10001;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

/* Modal Content */
.auth-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: slideUp 0.3s ease;
    position: relative;
}

/* Modal Header */
.auth-modal-header {
    padding: 32px 32px 24px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
}

.auth-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.auth-modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px;
}

.auth-modal-header p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* Close Button */
.auth-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.auth-modal-close:hover {
    background: #f3f4f6;
    color: #111827;
}

/* Tabs - Hidden by default, shown with .show-tabs class */
.auth-modal-tabs {
    display: none;
    border-bottom: 2px solid #e5e7eb;
    padding: 0 32px;
}

.auth-modal-tabs.show-tabs {
    display: flex;
}

.auth-modal-tab {
    flex: 1;
    padding: 16px;
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.auth-modal-tab:hover {
    color: #111827;
}

.auth-modal-tab.active {
    color: #10b981;
}

.auth-modal-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #10b981;
}

/* Forms */
.auth-modal-body {
    padding: 32px;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.form-group input:not([type="checkbox"]),
.form-group select {
    -webkit-appearance: none; /* ✅ iOS: Desactiva estilos nativos */
    appearance: none;
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px; /* ✅ iOS: Evita zoom automático al enfocar */
    transition: border-color 0.2s;
}

.form-group input:not([type="checkbox"]):focus,
.form-group select:focus {
    outline: none;
    border-color: #10b981;
}

.form-group input::placeholder {
    color: #9ca3af;
}

/* Input Wrapper for password toggle */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    padding-right: 45px !important;
}

.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    transition: opacity 0.2s;
}

.password-toggle:hover {
    opacity: 0.7;
}

/* Submit Button */
.auth-submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #4ADE80, #10b981);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.auth-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3);
}

.auth-submit-btn:active {
    transform: translateY(0);
}

/* Divider */
.auth-divider {
    text-align: center;
    margin: 24px 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e5e7eb;
}

.auth-divider span {
    position: relative;
    background: white;
    padding: 0 16px;
    font-size: 14px;
    color: #6b7280;
}

/* Helper Text */
.auth-helper-text {
    text-align: center;
    font-size: 14px;
    color: #6b7280;
    margin-top: 20px;
}

.auth-helper-text a {
    color: #10b981;
    text-decoration: none;
    font-weight: 600;
}

.auth-helper-text a:hover {
    text-decoration: underline;
}

/* Error Message */
.auth-error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    color: #dc2626;
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    animation: slideDown 0.3s ease;
}

.auth-error-message::before {
    content: "⚠️";
    flex-shrink: 0;
}

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

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

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

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .auth-modal-content {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 95vh;
    }

    .auth-modal-header,
    .auth-modal-body {
        padding: 24px 20px;
    }

    .auth-modal-tabs {
        padding: 0 20px;
    }

    .auth-modal-header h2 {
        font-size: 20px;
    }
}

/* Loading state */
.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-submit-btn.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Terms and Privacy Styles */
.terms-group {
    margin-bottom: 16px !important;
}

.terms-label {
    display: flex !important;
    align-items: flex-start !important;
    gap: 10px !important;
    cursor: pointer !important;
    font-weight: normal !important;
}

.terms-checkbox {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    cursor: pointer !important;
    margin-top: 2px !important;
    accent-color: #10b981;
}

.terms-text {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.5;
}

.terms-text a {
    color: #10b981;
    text-decoration: none;
    font-weight: 600;
}

.terms-text a:hover {
    text-decoration: underline;
}

/* Privacy Notice */
.privacy-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 20px;
}

.privacy-notice-icon {
    color: #6b7280;
    flex-shrink: 0;
    margin-top: 2px;
}

.privacy-notice-text {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
}

.privacy-notice-text a {
    color: #10b981;
    text-decoration: none;
    font-weight: 600;
}

.privacy-notice-text a:hover {
    text-decoration: underline;
}

/* Responsive adjustments for terms */
@media (max-width: 768px) {
    .terms-text {
        font-size: 13px;
    }

    .privacy-notice-text {
        font-size: 11px;
    }
}

/* Legal Terms Modal (Secondary Modal) */
.legal-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 10002; /* Higher than auth modal */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.legal-modal-container {
    background: white;
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.3s ease;
}

.legal-modal-header {
    padding: 24px 32px;
    border-bottom: 2px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.legal-modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.legal-modal-close {
    background: transparent;
    border: none;
    font-size: 32px;
    color: #9ca3af;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
    line-height: 1;
    padding: 0;
}

.legal-modal-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.legal-modal-body {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
    font-size: 15px;
    line-height: 1.7;
    color: #374151;
}

.legal-modal-body h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-top: 32px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}

.legal-modal-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-top: 24px;
    margin-bottom: 12px;
}

.legal-modal-body p {
    margin-bottom: 16px;
}

.legal-modal-body ul,
.legal-modal-body ol {
    margin-left: 24px;
    margin-bottom: 16px;
}

.legal-modal-body li {
    margin-bottom: 8px;
}

.legal-modal-body strong {
    color: #111827;
    font-weight: 600;
}

.legal-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #6b7280;
}

.legal-modal-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #10b981;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

/* Responsive for legal modal */
@media (max-width: 768px) {
    .legal-modal-container {
        max-width: 100%;
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
    }

    .legal-modal-header {
        padding: 20px;
    }

    .legal-modal-header h2 {
        font-size: 20px;
    }

    .legal-modal-body {
        padding: 20px;
    }
}
