/* DocuSort Homepage - Modal & Form Styles */

/* =============================================
   MODAL STYLES
   ============================================= */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    overflow-y: auto;
    padding: 20px 0;
    box-sizing: border-box;
}

.modal-content {
    background-color: white;
    margin: 0 auto;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    position: relative;
    animation: modal-slide-in 0.3s ease;
    min-height: auto;
    max-height: none;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.15);
}

@keyframes modal-slide-in {
    0% {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: 700;
    cursor: pointer;
    z-index: 1002;
    transition: var(--transition-fast);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
}

.close:hover {
    color: #000;
    background: rgba(255, 255, 255, 1);
}

/* =============================================
   FORM STYLES
   ============================================= */
.auth-form {
    padding: 2rem;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    overflow: visible;
}

/* Spezifische Höhenbegrenzung für das Registrierungsformular */
#registerForm {
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom Scrollbar für besseres Design */
#registerForm::-webkit-scrollbar {
    width: 8px;
}

#registerForm::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

#registerForm::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 10px;
    border: 2px solid #f1f5f9;
}

#registerForm::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
}

/* Firefox Scrollbar */
#registerForm {
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 #f1f5f9;
}

/* Login Form sollte keine Scrollbar brauchen */
#loginForm {
    overflow: visible;
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-size: 1.8rem;
    font-weight: 700;
}

.form-group {
    margin-bottom: 1rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition-fast);
    background: white;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.form-group input.error,
.form-group select.error {
    border-color: #e53e3e;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

.form-group input.valid,
.form-group select.valid {
    border-color: var(--success-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Remove any success indicators that might be added by JS */
.field-success {
    display: none !important;
}

.form-group .field-success {
    display: none !important;
}

.error-message {
    display: none; /* Standardmäßig versteckt */
    color: #e53e3e;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    min-height: 1.2rem;
    padding: 0.5rem 0;
    border-radius: 4px;
    transition: all 0.3s ease;
}

/* Wenn Error-Messages angezeigt werden sollen */
.error-message.show {
    display: block;
}

/* Shake animation für Fehler */
.shake {
    animation: shake 0.5s ease-in-out;
}

/* Plan Description Styles */
.plan-description {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.plan-description p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.plan-description i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Verstecke alle roten Balken die nicht error-message sind */
.field-error,
.validation-error,
.form-group::after {
    display: none !important;
}

/* Verhindere automatische Browser-Validierung Styles */
.form-group input:invalid,
.form-group select:invalid {
    box-shadow: none !important;
    border-color: var(--border-color) !important;
}

/* Verhindere alle Browser-Standard Validierungsstile */
input:invalid,
select:invalid,
textarea:invalid {
    box-shadow: none !important;
    outline: none !important;
}

/* Entferne alle automatischen Pseudo-Selektoren */
input:valid,
select:valid,
textarea:valid {
    box-shadow: none !important;
    border-color: var(--border-color) !important;
}

/* Nur unsere eigenen Error-Styles verwenden */
.form-group input.error,
.form-group select.error {
    border-color: #e53e3e !important;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1) !important;
}

/* Field-specific error messages */
.field-error-message {
    color: #e53e3e;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding-left: 1rem;
    display: none;
    animation: fadeInError 0.3s ease;
}

@keyframes fadeInError {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.field-error-message.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 20%, 40%, 60%, 80% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70% {
        transform: translateX(-5px);
    }
    15%, 35%, 55%, 75% {
        transform: translateX(5px);
    }
}

/* Global error message styling - versteckt by default */
#registerError,
#loginError {
    display: none !important; /* Versteckt standardmäßig */
    color: #e53e3e;
    font-size: 0.875rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: rgba(229, 62, 62, 0.1);
    border: 1px solid rgba(229, 62, 62, 0.2);
    border-radius: 8px;
    animation: fadeInError 0.3s ease;
}

/* Wenn Error-Messages angezeigt werden sollen */
#registerError.show,
#loginError.show {
    display: block !important;
}

#registerError.shake,
#loginError.shake {
    animation: shake 0.5s ease-in-out;
}

/* Form Row Layout */
.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.form-half {
    flex: 1;
    margin-bottom: 0;
}

/* Checkbox Styles */
.checkbox-group {
    margin: 2rem 0;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    line-height: 1.5;
    position: relative;
}

/* Special styling for privacy consent checkbox */
.checkbox-group .checkbox-label {
    align-items: flex-start;
    gap: 1rem;
}

.checkbox-group .checkbox-text {
    flex: 1;
    margin-top: 0;
    line-height: 1.6;
}

.checkbox-group .checkmark {
    margin-top: 0.1rem; /* Slight adjustment to align with first line of text */
}

/* Hide default checkbox */
.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkbox-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-left: 0;
}

.checkbox-text a {
    color: var(--primary-color);
    text-decoration: none;
}

.checkbox-text a:hover {
    text-decoration: underline;
}

/* Custom checkbox design */
.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 3px;
    position: relative;
    transition: var(--transition-fast);
    flex-shrink: 0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox-label:hover .checkmark {
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked ~ .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked ~ .checkmark::after {
    content: "✓";
    color: white;
    font-size: 12px;
    font-weight: bold;
    display: block;
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.remember {
    font-size: 0.9rem;
}

.forgot-password {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.forgot-password:hover {
    text-decoration: underline;
}

/* Form Submit */
.form-submit {
    text-align: center;
    margin: 2rem 0;
}

.form-submit .btn-primary {
    min-width: 150px;
    padding: 0.875rem 2rem;
}

/* Form Links */
.switch-link {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-secondary);
}

.switch-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.switch-link a:hover {
    text-decoration: underline;
}

/* =============================================
   PASSWORD REQUIREMENTS
   ============================================= */
.password-requirements {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    transition: var(--transition-fast);
}

.password-requirements.visible {
    opacity: 1;
    transform: translateY(0);
}

.password-requirements h4 {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.password-requirements ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.requirement {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0.4rem 0;
    transition: all 0.3s ease;
    padding: 0.2rem 0;
}

.requirement i {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    transition: all 0.4s ease;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.requirement.invalid i {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 2px solid #fca5a5;
    color: #dc2626;
}

.requirement.invalid i::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transition: width 0.4s ease;
}

.requirement.valid i {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border: 2px solid #86efac;
    color: #16a34a;
}

.requirement.valid i::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    transition: width 0.4s ease;
}

.requirement.valid i::after {
    content: "✓";
    position: relative;
    z-index: 2;
    color: white;
    font-weight: bold;
}

.requirement.valid {
    color: #16a34a;
}

.requirement.invalid {
    color: #dc2626;
}

/* Password Input States */
.form-group input[type="password"].checking {
    border-color: #f59e0b;
    box-shadow: 0 0 0 0.2rem rgba(245, 158, 11, 0.25);
}

.form-group input[type="password"].invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.25);
}

.form-group input[type="password"].valid {
    border-color: #16a34a;
    box-shadow: 0 0 0 0.2rem rgba(22, 163, 74, 0.25);
}

/* =============================================
   SUCCESS & ERROR MESSAGES
   ============================================= */
.success-message {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border: 1px solid #86efac;
    color: #166534;
    padding: 0.75rem;
    border-radius: 8px;
    margin: 1rem 0;
    display: none;
}

.error-message.global {
    background: linear-gradient(135deg, #fef2f2, #fecaca);
    border: 1px solid #fca5a5;
    color: #dc2626;
    padding: 0.75rem;
    border-radius: 8px;
    margin: 1rem 0;
    display: none;
}

/* =============================================
   REGISTRATION SUCCESS NOTIFICATION
   ============================================= */
.registration-success-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 10000;
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(16, 185, 129, 0.3);
    padding: 0;
    min-width: 320px;
    max-width: 500px;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.registration-success-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.registration-success-notification.hide {
    opacity: 0;
    transform: translateX(-50%) translateY(-100px);
}

.registration-success-notification .success-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
}

.registration-success-notification .success-icon {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.registration-success-notification .success-icon i {
    font-size: 1.8rem;
    color: white;
}

.registration-success-notification .success-text h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.registration-success-notification .success-text p {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    opacity: 0.95;
}

.registration-success-notification .success-text small {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Mobile responsive für Success Notification */
@media (max-width: 480px) {
    .registration-success-notification {
        left: 10px;
        right: 10px;
        transform: translateX(0) translateY(-100px);
        min-width: auto;
        max-width: none;
    }
    
    .registration-success-notification.show {
        transform: translateX(0) translateY(0);
    }
    
    .registration-success-notification.hide {
        transform: translateX(0) translateY(-100px);
    }
    
    .registration-success-notification .success-content {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .registration-success-notification .success-icon {
        width: 50px;
        height: 50px;
    }
    
    .registration-success-notification .success-icon i {
        font-size: 1.5rem;
    }
    
    .registration-success-notification .success-text h3 {
        font-size: 1.1rem;
    }
    
    .registration-success-notification .success-text p {
        font-size: 0.9rem;
    }
}

/* =============================================
   RESPONSIVE DESIGN FOR FORMS
   ============================================= */

/* Global Scrollbar Styling für bessere Optik */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    border-radius: 12px;
    border: 2px solid #f8fafc;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    border-color: #e2e8f0;
}

::-webkit-scrollbar-thumb:active {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #64748b #f8fafc;
}

/* Modal spezifische Scrollbar Verbesserungen */
.modal::-webkit-scrollbar {
    width: 8px;
}

.modal::-webkit-scrollbar-track {
    background: rgba(248, 250, 252, 0.8);
    border-radius: 10px;
}

.modal::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.8) 0%, rgba(29, 78, 216, 0.8) 100%);
    border-radius: 10px;
    border: 1px solid rgba(248, 250, 252, 0.5);
}

.modal::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.9) 0%, rgba(30, 64, 175, 0.9) 100%);
}

/* Verhindere doppelte Scrollbalken */
body.modal-open {
    overflow: hidden !important;
}

@media (max-height: 700px) {
    .modal {
        padding: 10px 0;
    }

    .modal-content {
        margin: 0 auto;
        max-height: none;
    }

    .auth-form {
        padding: 1.5rem;
    }

    #registerForm {
        max-height: calc(100vh - 40px);
    }
}

@media (max-width: 768px) {
    .modal {
        padding: 15px;
    }

    .modal-content {
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
        border-radius: 15px;
    }

    .auth-form {
        padding: 1.5rem;
        max-width: none;
    }

    #registerForm {
        max-height: calc(100vh - 60px);
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-half {
        margin-bottom: 1.2rem;
    }

    .form-options {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .modal {
        padding: 10px;
    }

    .modal-content {
        width: 100%;
        max-width: none;
        margin: 0 auto;
        border-radius: 12px;
    }

    .auth-form {
        padding: 1.25rem;
        max-width: none;
    }

    #registerForm {
        max-height: calc(100vh - 40px);
    }

    .password-requirements {
        padding: 0.75rem;
    }

    .form-group input,
    .form-group select {
        padding: 0.625rem;
        font-size: 0.95rem;
    }

    /* Kleinere Scrollbar auf Mobile */
    .modal::-webkit-scrollbar,
    #registerForm::-webkit-scrollbar {
        width: 6px;
    }
}
