/* --- Neutral color palette: black, gray, white --- */
:root {
    --main-black: #181818;
    --main-gray: #6c757d;
    --main-light-gray: #f5f6fa;
    --main-white: #fff;
    --main-border: #e0e0e0;
}

/* Enhanced Form Styling */
.form-container {
    background: var(--main-white);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(24, 24, 24, 0.06);
    border: 1px solid var(--main-border);
    backdrop-filter: blur(6px);
    position: relative;
    overflow: hidden;
}

.form-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--main-black);
    border-radius: 20px 20px 0 0;
}

/* Gradient Background Classes */
.bg-gradient-primary {
    background: linear-gradient(135deg, #999 0%, #919191 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #38a169 0%, #48bb78 100%);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #ed8936 0%, #f6ad55 100%);
}

.bg-gradient-info {
    background: linear-gradient(135deg, #4299e1 0%, #63b3ed 100%);
}

/* Enhanced Header Section */
.form-container .d-flex.align-items-center .bg-gradient-primary {
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.form-container .d-flex.align-items-center .bg-gradient-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.4);
}

.form-section {
    background: var(--main-light-gray);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(24, 24, 24, 0.04);
    border: 1px solid var(--main-border);
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.form-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
}

.form-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.form-section:hover::before {
    opacity: 1;
}

.form-section-title {
    color: var(--main-black);
    font-weight: 800;
    font-size: 1.4rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--main-border);
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-section-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 60px;
    height: 3px;
    background: var(--main-gray);
    border-radius: 2px;
}

.form-section-title i {
    color: var(--main-gray) !important;
    background: none !important;
    font-size: 1.6rem;
}

.form-label {
    color: var(--main-black);
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}

/* Enhanced Form Controls */
.form-floating {
    position: relative;
    margin-bottom: 1.8rem;
}

.form-floating>.form-control,
.form-floating>.form-select {
    height: 65px;
    padding: 1.2rem 1rem;
    border: 2px solid var(--main-border);
    border-radius: 16px;
    background: var(--main-white);
    font-size: 1rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(24, 24, 24, 0.03);
    backdrop-filter: blur(4px);
    color: var(--main-black);
}

.form-floating>.form-control:focus,
.form-floating>.form-select:focus {
    border-color: var(--main-black);
    box-shadow: 0 0 0 2px rgba(24, 24, 24, 0.08);
    background: var(--main-white);
    color: var(--main-black);
}

.form-floating>label {
    right: 0.75rem !important;
    left: auto !important;
    font-size: 1rem;
    padding-right: 2.2rem !important;
    /* Space for icon */
    z-index: 2;
    background: transparent;
}

.form-floating>.form-control:focus~label,
.form-floating>.form-control:not(:placeholder-shown)~label,
.form-floating>.form-select~label {
    font-size: 0.92rem;
    top: -0.7rem;
    right: 1.2rem !important;
    background: #fff;
    padding: 0 0.5rem;
    z-index: 3;
    opacity: 1;
}

/* For better appearance in RTL, ensure direction is set */
.form-floating>.form-control,
.form-floating>.form-select {
    direction: rtl;
}

/* Enhanced Input Groups */
.input-group {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    background: var(--main-white);
    backdrop-filter: blur(4px);
}

.input-group .form-control {
    border: 2px solid var(--main-border);
    border-radius: 16px;
    padding: 1rem 1.2rem;
    font-size: 1rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    color: var(--main-black);
}

.input-group .form-control:focus {
    border-color: var(--main-black);
    box-shadow: 0 0 0 2px rgba(24, 24, 24, 0.08);
    transform: translateY(-1px);
}

.input-group-text {
    background: var(--main-light-gray);
    border: 2px solid var(--main-border);
    color: var(--main-gray);
    font-weight: 600;
    padding: 1rem 1.2rem;
    font-size: 0.95rem;
}

/* Enhanced Select Controls */
.form-select {
    border: 2px solid var(--main-border);
    border-radius: 16px;
    padding: 1rem 1.2rem;
    font-size: 1rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%234a5568' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 1.2rem center;
    background-size: 18px 14px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--main-white);
    backdrop-filter: blur(4px);
    color: var(--main-black);
}

.form-select:focus {
    border-color: var(--main-black);
    box-shadow: 0 0 0 2px rgba(24, 24, 24, 0.08);
    transform: translateY(-1px);
}

/* Enhanced File Upload */
.file-upload-container {
    position: relative;
    border: 2px dashed var(--main-border);
    border-radius: 16px;
    padding: 2.5rem;
    text-align: center;
    background: var(--main-light-gray);
    transition: all 0.3s;
    cursor: pointer;
    backdrop-filter: blur(2px);
    overflow: hidden;
}

.file-upload-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.6s ease;
}

.file-upload-container:hover::before {
    left: 100%;
}

.file-upload-container:hover {
    border-color: var(--main-black);
    background: var(--main-white);
    box-shadow: 0 8px 24px rgba(24, 24, 24, 0.08);
}

.file-upload-container input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-icon {
    color: var(--main-gray) !important;
    font-size: 3.5rem;
    margin-bottom: 1.2rem;
    transition: all 0.3s;
}

.file-upload-container:hover .file-upload-icon {
    transform: scale(1.1);
}

.file-upload-text {
    color: var(--main-black);
    font-weight: 600;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.file-upload-hint {
    color: var(--main-gray);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Enhanced Buttons */
.btn-enhanced {
    border-radius: 16px;
    font-weight: 700;
    padding: 1rem 2.5rem;
    transition: all 0.3s;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    text-transform: none;
    letter-spacing: 0.5px;
    font-size: 1.1rem;
    background: var(--main-black);
    color: var(--main-white);
}

.btn-enhanced:hover {
    background: var(--main-gray);
    color: var(--main-white);
    border-color: var(--main-black);
}

.btn-primary-enhanced {
    background: var(--main-black);
    color: var(--main-white);
}

.btn-primary-enhanced:hover {
    background: var(--main-gray);
    color: var(--main-white);
}

.btn-secondary-enhanced {
    background: var(--main-gray);
    color: var(--main-white);
}

.btn-secondary-enhanced:hover {
    background: var(--main-black);
    color: var(--main-white);
}

/* Enhanced Validation States */
.form-control.is-invalid {
    border-color: #e53e3e;
    box-shadow: 0 0 0 4px rgba(229, 62, 62, 0.1);
}

.form-control.is-valid {
    border-color: #38a169;
    box-shadow: 0 0 0 4px rgba(56, 161, 105, 0.1);
}

.invalid-feedback {
    color: #e53e3e;
    font-weight: 500;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f8d7da;
    border-radius: 8px;
    border-right: 3px solid #e53e3e;
}

.valid-feedback {
    color: #38a169;
    font-weight: 500;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: #e6fffa;
    border-radius: 8px;
    border-right: 3px solid #38a169;
}

/* Enhanced Alerts */
.alert-enhanced {
    border-radius: 16px;
    border: none;
    padding: 1.2rem 1.5rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(24, 24, 24, 0.04);
    background: var(--main-light-gray);
    color: var(--main-black);
}

.alert-success-enhanced {
    background: #e6fffa;
    color: #22543d;
    border-right: 4px solid #38a169;
}

.alert-info-enhanced {
    background: #f5f6fa;
    color: var(--main-black);
    border-right: 4px solid var(--main-gray);
}

.alert-warning-enhanced {
    background: #fffbea;
    color: #744210;
    border-right: 4px solid #ed8936;
}

.alert-danger-enhanced {
    background: #f8d7da;
    color: #742a2a;
    border-right: 4px solid #e53e3e;
}

/* Loading Animation */
.form-loading {
    position: relative;
    pointer-events: none;
}

.form-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Animation Classes */
.animate__animated {
    animation-duration: 0.6s;
    animation-fill-mode: both;
}

.animate__fadeIn {
    animation-name: fadeIn;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-container {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .form-section {
        padding: 1.5rem;
        border-radius: 12px;
    }

    .btn-enhanced {
        padding: 0.875rem 2rem;
        font-size: 1rem;
    }

    .file-upload-container {
        padding: 2rem 1.5rem;
    }

    .file-upload-icon {
        font-size: 3rem;
    }

    .form-section-title {
        font-size: 1.25rem;
    }
}

/* Focus States */
.form-control:focus,
.form-select:focus {
    outline: none;
}

.form-control:focus-visible,
.form-select:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .form-container {
        box-shadow: none;
        border: 1px solid #e2e8f0;
    }

    .btn-enhanced {
        display: none;
    }

    .file-upload-container {
        border: 1px solid #e2e8f0;
        background: #f7fafc;
    }
}

@media (max-width: 991.98px) {
    .auth-modern-container .row {
        flex-direction: column;
    }

    .auth-modern-card {
        margin-bottom: 2rem;
        max-width: 100%;
        min-width: 0;
    }
}