/**
 * Authentication Modal Styles
 * Matches Water Security App design system
 */

/* Blur overlay - covers entire screen with balanced gradient */
#authOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(70, 130, 180, 0.8) 0%, rgba(100, 149, 237, 0.8) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.6s ease, backdrop-filter 0.6s ease;
}

#authOverlay.fade-out {
    opacity: 0;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    pointer-events: none;
}

/* Main modal container */
#authModal {
    background: #ffffff;
    border-radius: 33px;
    box-shadow: 0 30px 80px -15px rgba(102, 126, 234, 0.5);
    max-width: 500px;
    width: 100%;
    position: relative;
    z-index: 9999;
    overflow: hidden;
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: #ffffff;
    border-style: solid;
    border-width: 1px;

}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header section with balanced gradient */
.auth-header {
    background: linear-gradient(135deg, #4682B4 0%, #5A9BD4 100%);
    padding: 40px 20px 35px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.auth-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, 30px); }
}

/* Water droplet emoji logo */
.auth-logo {
    font-size: 72px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
    line-height: 1;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-logo img {
    max-width: 90%;
    max-height: 120px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.auth-header h1 {
    color: #ffffff;
    margin: 0 0 10px 0;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.auth-header p {
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

/* Content section */
.auth-content {
    padding: 35px 30px 40px;
}

.auth-description {
    text-align: center;
    color: #5D4E37;
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 28px;
}

.auth-description strong {
    display: block;
    color: #2C5AA0;
    font-weight: 800;
    font-size: 24px;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

/* Form styles */
.auth-form {
    margin-bottom: 0;
}

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

.auth-form-group label {
    display: block;
    color: #2C5AA0;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 10px;
    text-align: left;
    letter-spacing: 0.3px;
}

.auth-form-group input {
    font-size: 16px !important;
    padding: 16px 18px;
    width: 100%;
    border: 2px solid #B3D9FF;
    border-radius: 14px;
    font-family: 'Rubik', inherit;
    font-weight: 500;
    color: #2C5AA0;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, #f0f6ff 0%, #ffffff 100%);
}

.auth-form-group input:focus {
    outline: none;
    border-color: #2C5AA0;
    box-shadow: 0 0 0 4px rgba(44, 90, 160, 0.1);
    background: #ffffff;
}

.auth-form-group input::placeholder {
    color: #7FA3C6;
    font-weight: 400;
}

/* Submit button - balanced gradient */
.auth-submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #4682B4 0%, #5A9BD4 100%);
    color: #ffffff;
    padding: 18px 24px;
    font-size: 17px;
    font-weight: 700;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(70, 130, 180, 0.4);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-submit-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(70, 130, 180, 0.5);
}

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

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

.auth-submit-btn.loading {
    color: transparent;
}

.auth-submit-btn .spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: authSpinnerRotate 0.8s linear infinite;
    display: none;
    margin-left: -10px;
    margin-top: -10px;
}

.auth-submit-btn.loading .spinner {
    display: block;
}

@keyframes authSpinnerRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Success message - vibrant green */
.auth-success {
    display: none;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    padding: 18px 22px;
    border-radius: 14px;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 20px;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    animation: successSlide 0.4s ease;
}

.auth-success.show {
    display: block;
}

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

/* Error message - vibrant red */
.auth-error {
    display: none;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #ffffff;
    padding: 16px 20px;
    border-radius: 14px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 20px;
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.4);
    animation: errorShake 0.4s ease;
}

.auth-error.show {
    display: block;
}

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

/* Security notice - balanced info box */
.auth-notice {
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    padding: 20px;
    border-radius: 14px;
    margin-top: 25px;
    text-align: left;
    box-shadow: 0 6px 20px rgba(107, 142, 35, 0.25);
    border-left: 4px solid #6B8E23;
}

.auth-notice-title {
    color: #2D5A2D;
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-notice-text {
    color: #3D5C3D;
    font-size: 14px;
    margin: 0;
    line-height: 1.6;
    font-weight: 500;
}

/* 6-Digit Code Input Section */
.code-input-section {
    display: none;
    margin-top: 25px;
}

.code-input-section.show {
    display: block;
}

.code-inputs-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 25px 0;
}

.code-input {
    width: 56px;
    height: 68px;
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    border: 3px solid #e2e8f0;
    border-radius: 14px;
    background: #ffffff;
    color: #667eea;
    font-family: 'Courier New', monospace;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.code-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15), 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: scale(1.05);
}

.code-input.filled {
    border-color: #10b981;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.code-input.error {
    border-color: #f5576c;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    animation: shake 0.3s ease;
}

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

.code-input-label {
    text-align: center;
    color: #2d3748;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
}

.code-input-hint {
    text-align: center;
    color: #718096;
    font-size: 14px;
    margin-top: 15px;
    line-height: 1.5;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    #authModal {
        max-width: 95%;
        margin: 0 10px;
        border-radius: 20px;
    }

    .auth-header {
        padding: 30px 15px 25px;
    }

    .auth-header h1 {
        font-size: 24px !important;
        margin-bottom: 4px !important;
    }

    .auth-header p {
        font-size: 14px !important;
        margin-top: 4px !important;
    }

    .auth-logo {
        font-size: 56px;
        margin-bottom: 12px;
    }

    .auth-logo img {
        max-width: 85% !important;
        max-height: 100px !important;
    }

    .auth-content {
        padding: 20px 15px 25px;
    }

    .auth-description {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .auth-description strong {
        font-size: 20px !important;
        margin-bottom: 10px !important;
    }

    .code-inputs-container {
        gap: 6px;
    }

    .code-input {
        width: 44px;
        height: 56px;
        font-size: 24px;
    }
}

/* Loading state for the main app */
.app-loading {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

/* Privacy Policy Link */
.privacy-policy-link-container {
    text-align: center;
    margin-top: 20px;
}

.privacy-policy-btn {
    background: transparent;
    border: none;
    color: #2C5AA0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-family: 'Rubik', inherit;
}

.privacy-policy-btn:hover {
    background: rgba(44, 90, 160, 0.08);
    transform: translateY(-1px);
}

.privacy-policy-btn:active {
    transform: translateY(0);
}

.privacy-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

/* Privacy Policy Modal Overlay */
.privacy-policy-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.privacy-policy-overlay.show {
    display: flex;
    opacity: 1;
}

/* Privacy Policy Modal */
.privacy-policy-modal {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: privacyModalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Privacy Policy Header */
.privacy-policy-header {
    background: linear-gradient(135deg, #4682B4 0%, #5A9BD4 100%);
    padding: 25px 30px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.privacy-policy-header h2 {
    color: #ffffff;
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.close-privacy-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.close-privacy-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.close-privacy-btn svg {
    width: 20px;
    height: 20px;
    color: #ffffff;
}

/* Privacy Policy Content */
.privacy-policy-content {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.privacy-section {
    margin-bottom: 25px;
}

.privacy-section:last-child {
    margin-bottom: 0;
}

.privacy-section h3 {
    color: #2C5AA0;
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.privacy-section p {
    color: #5D4E37;
    font-size: 15px;
    line-height: 1.7;
    margin: 0 0 12px 0;
}

.privacy-section p:last-child {
    margin-bottom: 0;
}

.privacy-section ul {
    margin: 12px 0;
    padding-left: 25px;
    color: #5D4E37;
}

.privacy-section li {
    margin: 8px 0;
    line-height: 1.6;
    font-size: 15px;
}

.privacy-section strong {
    color: #2C5AA0;
    font-weight: 700;
}

.privacy-contact {
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #6B8E23;
    margin-top: 30px;
}

.privacy-contact p {
    color: #2D5A2D;
    font-weight: 500;
}

/* Responsive adjustments for privacy modal */
@media (max-width: 640px) {
    .privacy-policy-modal {
        max-width: 95%;
        max-height: 90vh;
        border-radius: 16px;
    }

    .privacy-policy-header {
        padding: 20px;
        border-radius: 16px 16px 0 0;
    }

    .privacy-policy-header h2 {
        font-size: 20px;
    }

    .privacy-policy-content {
        padding: 20px;
    }

    .privacy-section h3 {
        font-size: 16px;
    }

    .privacy-section p,
    .privacy-section li {
        font-size: 14px;
    }
}
