/**
 * MapaSEO Google Authentication Styles
 * Modern, clean design inspired by Localo interface
 */

/* Variables */
:root {
    --mapaseo-primary: #4F7FFF;
    --mapaseo-primary-dark: #3D6BFF;
    --mapaseo-secondary: #6366F1;
    --mapaseo-success: #10B981;
    --mapaseo-error: #EF4444;
    --mapaseo-warning: #F59E0B;
    --mapaseo-gray-50: #F9FAFB;
    --mapaseo-gray-100: #F3F4F6;
    --mapaseo-gray-200: #E5E7EB;
    --mapaseo-gray-300: #D1D5DB;
    --mapaseo-gray-400: #9CA3AF;
    --mapaseo-gray-500: #6B7280;
    --mapaseo-gray-600: #4B5563;
    --mapaseo-gray-700: #374151;
    --mapaseo-gray-800: #1F2937;
    --mapaseo-gray-900: #111827;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition: all 0.2s ease-in-out;
    --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);
}

/* Reset and Base Styles */
.mapaseo-auth-container {
    max-width: 420px;
    margin: 0 auto;
    padding: 2rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.mapaseo-auth-container * {
    box-sizing: border-box;
}

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

.auth-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--mapaseo-gray-900);
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
}

.auth-header p {
    font-size: 1rem;
    color: var(--mapaseo-gray-600);
    margin: 0;
    line-height: 1.5;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    background: var(--mapaseo-gray-100);
    border-radius: var(--border-radius-sm);
    padding: 4px;
    margin-bottom: 2rem;
}

.auth-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--mapaseo-gray-600);
    cursor: pointer;
    transition: var(--transition);
}

.auth-tab.active {
    background: white;
    color: var(--mapaseo-gray-900);
    box-shadow: var(--shadow-sm);
}

.auth-tab:hover:not(.active) {
    color: var(--mapaseo-gray-700);
}

/* Auth Sections */
.auth-section {
    display: none;
}

.auth-section.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Google Sign-In Button */
.google-auth-section {
    margin-bottom: 1.5rem;
}

.google-signin-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0.875rem 1rem;
    background: white;
    border: 1px solid var(--mapaseo-gray-300);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--mapaseo-gray-700);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.google-signin-btn:hover {
    background: var(--mapaseo-gray-50);
    border-color: var(--mapaseo-gray-400);
    color: var(--mapaseo-gray-800);
}

.google-signin-btn:active {
    transform: translateY(1px);
}

.google-signin-btn img {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.google-signin-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.google-signin-btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--mapaseo-gray-300);
    border-top: 2px solid var(--mapaseo-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

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

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

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--mapaseo-gray-200);
}

.auth-divider span {
    background: white;
    padding: 0 1rem;
    font-size: 0.875rem;
    color: var(--mapaseo-gray-500);
}

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

.form-group {
    position: relative;
}

.form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--mapaseo-gray-300);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    color: var(--mapaseo-gray-900);
    background: white;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--mapaseo-primary);
    box-shadow: 0 0 0 3px rgba(79, 127, 255, 0.1);
}

.form-group input.error {
    border-color: var(--mapaseo-error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-group input::placeholder {
    color: var(--mapaseo-gray-400);
}

/* Password Toggle */
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--mapaseo-gray-400);
    transition: var(--transition);
}

.password-toggle:hover {
    color: var(--mapaseo-gray-600);
}

/* Password Strength */
.password-strength {
    margin-top: 0.5rem;
}

.strength-bar {
    width: 100%;
    height: 4px;
    background: var(--mapaseo-gray-200);
    border-radius: 2px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    border-radius: 2px;
    transition: var(--transition);
}

.strength-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.checkbox-group input[type="checkbox"] {
    width: auto !important;
    margin: 0;
    margin-top: 2px;
    flex-shrink: 0;
}

.checkbox-group label {
    font-size: 0.875rem;
    color: var(--mapaseo-gray-600);
    line-height: 1.5;
    cursor: pointer;
}

.checkbox-group label a {
    color: var(--mapaseo-primary);
    text-decoration: none;
}

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

.checkbox-group.error input[type="checkbox"] {
    border-color: var(--mapaseo-error);
}

/* Submit Button */
.auth-submit-btn {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--mapaseo-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 0.5rem;
}

.auth-submit-btn:hover:not(:disabled) {
    background: var(--mapaseo-primary-dark);
    transform: translateY(-1px);
}

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

.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.auth-submit-btn.loading {
    opacity: 0.8;
    pointer-events: none;
}

.auth-submit-btn.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

/* Forgot Password */
.forgot-password {
    text-align: center;
    margin-top: 1rem;
}

.forgot-password a {
    font-size: 0.875rem;
    color: var(--mapaseo-primary);
    text-decoration: none;
}

.forgot-password a:hover {
    text-decoration: underline;
}

/* Error Messages */
.error-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--mapaseo-error);
    font-weight: 500;
}

/* Auth Messages */
.auth-message {
    padding: 0.875rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    border: 1px solid;
}

.auth-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--mapaseo-success);
    border-color: rgba(16, 185, 129, 0.2);
}

.auth-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--mapaseo-error);
    border-color: rgba(239, 68, 68, 0.2);
}

/* Responsive Design */
@media (max-width: 480px) {
    .mapaseo-auth-container {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .auth-header h2 {
        font-size: 1.5rem;
    }
    
    .auth-tabs {
        flex-direction: column;
    }
    
    .auth-tab {
        text-align: center;
    }
    
    .google-signin-btn {
        font-size: 0.8rem;
        padding: 0.75rem;
    }
    
    .google-signin-btn span {
        display: none;
    }
    
    .google-signin-btn::after {
        content: "Continuar con Google";
        font-size: 0.8rem;
    }
}

/* Integration with existing account page */
.woocommerce-account .mapaseo-auth-container {
    max-width: 100%;
    margin: 2rem 0;
    box-shadow: none;
    border: 1px solid var(--mapaseo-gray-200);
}

/* Hide default WooCommerce forms when custom auth is active */
.mapaseo-auth-container ~ .woocommerce-form-login,
.mapaseo-auth-container ~ .woocommerce-form-register {
    display: none !important;
}

/* Account page specific styles */
.woocommerce-account .auth-header h2 {
    color: var(--primary-blue, var(--mapaseo-primary));
}

.woocommerce-account .auth-submit-btn {
    background: var(--primary-blue, var(--mapaseo-primary));
}

.woocommerce-account .auth-submit-btn:hover {
    background: var(--primary-blue-dark, var(--mapaseo-primary-dark));
}

.woocommerce-account .checkbox-group label a,
.woocommerce-account .forgot-password a {
    color: var(--primary-blue, var(--mapaseo-primary));
}

/* Google Profile Info */
.google-profile-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--mapaseo-gray-50);
    border-radius: var(--border-radius-sm);
    margin-bottom: 1rem;
}

.google-profile-picture {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--mapaseo-gray-200);
}

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

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--mapaseo-gray-200);
    border-top: 4px solid var(--mapaseo-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Focus States */
.form-group input:focus,
.auth-tab:focus,
.google-signin-btn:focus,
.auth-submit-btn:focus {
    outline: 2px solid var(--mapaseo-primary);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .auth-tab.active {
        border: 2px solid var(--mapaseo-gray-900);
    }
    
    .form-group input:focus {
        border-width: 2px;
    }
    
    .google-signin-btn {
        border-width: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .auth-section.active {
        animation: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --mapaseo-gray-50: #111827;
        --mapaseo-gray-100: #1F2937;
        --mapaseo-gray-200: #374151;
        --mapaseo-gray-300: #4B5563;
        --mapaseo-gray-400: #6B7280;
        --mapaseo-gray-500: #9CA3AF;
        --mapaseo-gray-600: #D1D5DB;
        --mapaseo-gray-700: #E5E7EB;
        --mapaseo-gray-800: #F3F4F6;
        --mapaseo-gray-900: #F9FAFB;
    }
    
    .mapaseo-auth-container {
        background: var(--mapaseo-gray-100);
        border: 1px solid var(--mapaseo-gray-200);
    }
    
    .auth-divider::before {
        background: var(--mapaseo-gray-300);
    }
    
    .auth-divider span {
        background: var(--mapaseo-gray-100);
    }
    
    .google-signin-btn {
        background: var(--mapaseo-gray-50);
        border-color: var(--mapaseo-gray-300);
        color: var(--mapaseo-gray-700);
    }
    
    .google-signin-btn:hover {
        background: var(--mapaseo-gray-200);
    }
    
    .form-group input {
        background: var(--mapaseo-gray-50);
        border-color: var(--mapaseo-gray-300);
        color: var(--mapaseo-gray-900);
    }
    
    .strength-bar {
        background: var(--mapaseo-gray-300);
    }
}

/* Print Styles */
@media print {
    .mapaseo-auth-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .google-signin-btn,
    .auth-submit-btn {
        border: 1px solid #000;
        background: white !important;
        color: black !important;
    }
    
    .auth-message {
        border: 1px solid #000;
        background: white !important;
    }
}

/* Custom Scrollbar */
.mapaseo-auth-container::-webkit-scrollbar {
    width: 6px;
}

.mapaseo-auth-container::-webkit-scrollbar-track {
    background: var(--mapaseo-gray-100);
    border-radius: 3px;
}

.mapaseo-auth-container::-webkit-scrollbar-thumb {
    background: var(--mapaseo-gray-300);
    border-radius: 3px;
}

.mapaseo-auth-container::-webkit-scrollbar-thumb:hover {
    background: var(--mapaseo-gray-400);
}

/* Additional Utility Classes */
.text-center {
    text-align: center;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-4 {
    padding: 1rem;
}

.px-3 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* State Classes */
.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

.is-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.is-hidden {
    display: none !important;
}

.is-visible {
    display: block !important;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.slide-up {
    animation: slideUp 0.3s ease-in-out;
}

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

.shake {
    animation: shake 0.5s ease-in-out;
}

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

/* Success and Error State Animations */
.form-group.success input {
    border-color: var(--mapaseo-success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-group.error input {
    animation: shake 0.5s ease-in-out;
}

/* Hover Effects */
.google-signin-btn:hover {
    box-shadow: var(--shadow-md);
}

.auth-submit-btn:hover:not(:disabled) {
    box-shadow: var(--shadow-md);
}

/* Focus Visible for Better Accessibility */
.google-signin-btn:focus-visible,
.auth-submit-btn:focus-visible,
.auth-tab:focus-visible {
    outline: 2px solid var(--mapaseo-primary);
    outline-offset: 2px;
}

/* Custom Checkbox Styling */
.checkbox-group input[type="checkbox"] {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--mapaseo-gray-300);
    border-radius: 3px;
    background: white;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.checkbox-group input[type="checkbox"]:checked {
    background: var(--mapaseo-primary);
    border-color: var(--mapaseo-primary);
}

.checkbox-group input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: -2px;
    left: 1px;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-group input[type="checkbox"]:focus {
    box-shadow: 0 0 0 3px rgba(79, 127, 255, 0.1);
}

/* Google Logo Animation */
.google-signin-btn img {
    transition: var(--transition);
}

.google-signin-btn:hover img {
    transform: scale(1.1);
}

/* Improved Loading Button */
.auth-submit-btn.loading,
.google-signin-btn.loading {
    position: relative;
    color: transparent;
}

.auth-submit-btn.loading::before,
.google-signin-btn.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.google-signin-btn.loading::before {
    border: 2px solid var(--mapaseo-gray-300);
    border-top: 2px solid var(--mapaseo-primary);
}