body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: #f8fafc;
    background-image: 
        radial-gradient(at 0% 0%, rgba(219, 228, 255, 0.8) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(238, 224, 255, 0.6) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(212, 232, 255, 0.7) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(226, 232, 240, 0.8) 0px, transparent 50%);
    background-attachment: fixed;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow-x: hidden;
    transition: all 0.3s ease-in-out;
    color: #1e293b;
    position: relative;
    padding-bottom: 25px;
}

body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

/* Ensure modal is always on top */
#googleModal {
    position: fixed !important;
    z-index: 9999 !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: radial-gradient(rgba(15, 23, 42, 0.04) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    z-index: -1;
}

#content {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 10;
    isolation: isolate; /* Create new stacking context */
}


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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

#auth-page {
    min-height: 100vh;
    position: relative;
    z-index: 10;
}

#content {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 16px;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.1),
        0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    max-width: 450px;
    width: 100%;
}

#content .card-header {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    padding: 1rem 1.5rem 0.5rem;
    backdrop-filter: blur(10px);
}

#content .card-header h3 {
    font-weight: 700;
    font-size: 1.75rem;
    color: #1e293b;
    letter-spacing: -0.5px;
    margin-top: 0.5rem;
}

/* Logo Styles */
.logo-container-modern {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-top: 0.5rem;
}

.logo-modern {
    max-width: 140px;
    max-height: 75px;
    height: auto;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.logo-modern:hover {
    transform: scale(1.05);
}

@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-dialog-centered {
        min-height: calc(100% - 1rem);
    }
    
    .logo-modern {
        max-width: 100px;
        max-height: 65px;
    }
    
    #content .card-header {
        padding: 1rem 1.5rem 1rem;
    }
    
    #content .card-header h3 {
        font-size: 1.5rem;
    }
    
    .modal {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

#content .card-body {
    padding: 1.25rem 1.5rem;
}

/* Modern Form Styles */
.signin-form-modern {
    animation: slideIn 0.6s ease-out 0.2s both;
}

.form-group-modern {
    position: relative;
    margin-bottom: 1rem;
}

.input-wrapper-modern {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: #667eea;
    z-index: 2;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.form-control-modern {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.8rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 0.9375rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fff;
    color: #333;
    outline: none;
}

.form-control-modern:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.form-control-modern:focus + .floating-label,
.form-control-modern.has-value + .floating-label,
.form-control-modern:not(:placeholder-shown) + .floating-label {
    top: -0.5rem;
    left: 0.75rem;
    font-size: 0.75rem;
    color: #667eea;
    background: #fff;
    padding: 0 0.5rem;
    z-index: 3;
}

.floating-label {
    position: absolute;
    left: 2.8rem;
    top: 0.75rem;
    color: #999;
    font-size: 0.9375rem;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    white-space: nowrap;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
    z-index: 2;
}

.password-toggle:hover {
    color: #667eea;
}

.error-message-modern {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    animation: slideIn 0.3s ease;
}

/* Modern Button Styles */
.btn-modern {
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-transform: none;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    line-height: 1.5;
}

.btn-primary-modern {
    background: #0d6efd;
    color: white;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    vertical-align: middle;
    line-height: 1.5;
    min-height: 44px;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.btn-primary-modern i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    line-height: 1;
    margin: 0;
}

.btn-primary-modern:hover {
    background: #0b5ed7;
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
    color: white;
    text-decoration: none;
}

.btn-primary-modern:active {
    transform: translateY(0);
}

.btn-primary-modern:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Social Buttons */
.divider-modern {
    position: relative;
    text-align: center;
    margin: 1.25rem 0;
    color: #999;
    font-size: 0.875rem;
}

.divider-modern::before,
.divider-modern::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 45%;
    height: 1px;
    background: linear-gradient(to right, transparent, #e0e0e0, transparent);
}

.divider-modern::before {
    left: 0;
}

.divider-modern::after {
    right: 0;
}

.social-buttons-modern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: stretch;
}

.social-buttons-modern .btn-social {
    height: 100%;
    min-height: 42px;
}

.btn-social {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: #fff;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
    vertical-align: middle;
    line-height: 1.5;
}

.btn-social:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.btn-social i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    font-size: 1.25rem;
    line-height: 1;
}

.btn-social span {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    line-height: 1.5;
}

.btn-social:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    color: #333;
    text-decoration: none;
}

.btn-google {
    border-color: #ea4335;
    color: #ea4335;
}

.btn-google:hover {
    background: #ea4335;
    color: white;
    border-color: #ea4335;
}

.btn-whatsapp {
    border-color: #25d366;
    color: #25d366;
}

.btn-whatsapp:hover {
    background: #25d366;
    color: white;
    border-color: #25d366;
}

/* Icon styling moved above */

/* Footer Links */
.auth-footer-modern {
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.footer-link-modern {
    color: #667eea;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
}

.footer-link-modern:hover {
    color: #764ba2;
    text-decoration: none;
    transform: translateX(4px);
}

/* Alert Modern */
.alert-modern {
    border-radius: 12px;
    border: none;
    padding: 1rem 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: slideIn 0.4s ease;
}

.alert-info-modern {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.1) 0%, rgba(13, 110, 253, 0.05) 100%);
    color: #0d6efd;
    border-left: 4px solid #0d6efd;
}

/* Captcha Wrapper */
.captcha-wrapper-modern {
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
}

#div_id_captcha legend {
    display: none !important;
}

#div_id_captcha {
    margin-bottom: 0px !important;
}

/* Modal Modern - Fixed z-index issues */
.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 9999 !important;
    width: 100% !important;
    height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    display: none;
    outline: 0;
}

.modal.show {
    display: block !important;
}

.modal.fade {
    opacity: 0;
    transition: opacity 0.15s linear;
}

.modal.fade.show {
    opacity: 1;
}

.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    transform: translate(0, -50px);
    opacity: 0;
}

.modal.show .modal-dialog {
    transform: translate(0, 0) !important;
    opacity: 1 !important;
}

.modal-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 9998 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    pointer-events: auto;
}

.modal-backdrop.show {
    display: block !important;
}

.modal-backdrop.fade {
    opacity: 0;
    transition: opacity 0.15s linear;
}

.modal-backdrop.fade.show {
    opacity: 0.5;
}

.modal-modern {
    border-radius: 16px;
    border: none;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    background: #fff;
    position: relative;
    margin: 0;
    z-index: 1;
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem auto;
    max-width: 550px;
    pointer-events: auto;
    z-index: 10001;
}

.modal-dialog.modal-xl {
    max-width: 800px;
}

.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: #fff;
    background-clip: padding-box;
    border: none;
    border-radius: 16px;
    outline: 0;
    z-index: 10002;
}

@media (max-width: 1200px) {
    .modal-dialog.modal-xl {
        max-width: 700px;
    }
}

@media (max-width: 768px) {
    .modal-dialog.modal-xl {
        max-width: 95%;
    }
}

@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-dialog-centered {
        min-height: calc(100% - 1rem);
    }
    
    .modal-dialog.modal-xl {
        max-width: calc(100% - 1rem);
    }
    
    .logo-modern {
        max-width: 100px;
        max-height: 60px;
    }
}

.modal-header-modern {
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    align-items: center;
    gap: 1rem;
    backdrop-filter: blur(10px);
}

.modal-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(234, 67, 53, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.modal-header-modern .modal-title {
    font-weight: 700;
    font-size: 1.5rem;
    margin: 0;
    flex: 1;
}

.btn-close-modern {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.btn-close-modern:hover {
    opacity: 1;
}

.info-box-modern {
    display: flex;
    gap: 1rem;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 10px;
    padding: 1.25rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.info-icon {
    font-size: 1.25rem;
    color: #0d6efd;
    flex-shrink: 0;
}

.info-content {
    flex: 1;
}

.info-list-modern {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.info-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.info-item i {
    font-size: 1.125rem;
    margin-top: 0.25rem;
    flex-shrink: 0;
}

.info-item code {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8125rem;
}

.modal-footer-modern {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    background: #fff;
}

.modal-body {
    background: #fff;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.modal-footer-modern .btn,
.modal-footer-modern a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 3px;
    font-weight: 500;
    transition: all 0.2s ease;
    vertical-align: middle;
    line-height: 1.5;
    min-height: 35px;
    box-sizing: border-box;
    position: relative;
    z-index: 10003;
    pointer-events: auto;
}

.modal-footer-modern .btn i,
.modal-footer-modern a.btn i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    line-height: 1;
    margin: 0;
}

.btn-outline-success-modern,
.btn-outline-secondary-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid;
    vertical-align: middle;
    line-height: 1.5;
    text-decoration: none;
    min-height: 44px;
}

.btn-outline-success-modern i,
.btn-outline-secondary-modern i {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    line-height: 1;
}

.btn-outline-success-modern {
    border-color: #198754;
    color: #198754;
}

.btn-outline-success-modern:hover {
    background: #198754;
    color: white;
}

.btn-outline-secondary-modern {
    border-color: #6c757d;
    color: #6c757d;
}

.btn-outline-secondary-modern:hover {
    background: #6c757d;
    color: white;
}

/* Responsive Design */
@media (max-width: 576px) {
    #content {
        margin: 1rem;
        border-radius: 20px;
    }
    
    #content .card-header,
    #content .card-body {
        padding: 1.5rem;
    }
    
    .social-buttons-modern {
        grid-template-columns: 1fr;
    }
    
    .modal-footer-modern {
        flex-direction: column;
    }
    
    .modal-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-actions .btn {
        width: 100%;
    }
    .modal-footer-modern .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.fa-spinner {
    animation: spin 1s linear infinite;
}

/* Status Badge */
.status-badge-modern {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    background: rgba(25, 135, 84, 0.1);
    border-radius: 20px;
    font-size: 0.75rem;
    color: #198754;
    font-weight: 500;
    animation: pulse 2s ease-in-out infinite;
}

.status-badge-modern i {
    font-size: 0.5rem;
    animation: blink 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* Smooth transitions for all interactive elements */
* {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* Focus visible for accessibility */
.form-control-modern:focus-visible,
.btn-modern:focus-visible,
.btn-social:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}