@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #72367A;
    --secondary-color: #ffa500;
    --accent-color: #ff6b35;
    --dark-green: #5a8f20;
    --light-green: #e8f5d8;
    --white: #ffffff;
    --light-gray: #f9fafb;
    --gray: #6b7280;
    --dark-gray: #1f2937;
    --border-light: #e5e7eb;
    --border-radius: 12px;
    --box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', sans-serif;
    line-height: 1.6;
    color: var(--dark-gray);
    background: var(--light-gray);
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--primary-color);
    color: var(--white);
    padding: 1rem 0;
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.back-btn {
    background: rgba(255,255,255,0.2);
    color: var(--white);
    padding: 12px 24px;
    border-radius: var(--border-radius);
    text-decoration: none;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.back-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
    color: var(--white);
    text-decoration: none;
}

/* Main Container */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* Form Header */
.form-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--box-shadow);
}

.form-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--dark-gray);
    margin-bottom: 10px;
}

.form-header p {
    color: var(--gray);
    font-size: 1.2rem;
    font-weight: 500;
}

/* Progress Bar */
.progress-container {
    background: white;
    border-radius: 20px;
    box-shadow: var(--box-shadow);
    padding: 40px;
    margin-bottom: 30px;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 20px;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--border-light);
    z-index: 1;
}

.progress-line {
    position: absolute;
    top: 20px;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.5s ease;
    z-index: 2;
    width: 0%;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 3;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--white);
    border: 3px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--gray);
    transition: var(--transition);
    margin-bottom: 10px;
}

.step.active .step-circle {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.step.completed .step-circle {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

.step-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray);
    text-align: center;
    white-space: nowrap;
}

.step.active .step-label {
    color: var(--primary-color);
    font-weight: 700;
}

/* Form Steps */
.form-step {
    display: none;
    background: white;
    border-radius: 20px;
    box-shadow: var(--box-shadow);
    padding: 40px;
    margin-bottom: 30px;
}

.form-step.active {
    display: block;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Section Titles */
.step-title {
    color: var(--primary-color);
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--light-gray);
    font-size: 1.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 15px;
}

.step-title i {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
}

/* Form Elements */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group.required label::after {
    content: ' *';
    color: var(--secondary-color);
    font-weight: 700;
}

label {
    display: block;
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 8px;
    font-size: 1rem;
}

input, select, textarea {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: 'DM Sans', sans-serif;
    transition: var(--transition);
    background: var(--light-gray);
    font-weight: 500;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(119, 184, 42, 0.1);
    background: white;
}

select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px 12px;
    appearance: none;
    cursor: pointer;
}

/* Radio and Checkbox Groups */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.checkbox-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: var(--light-gray);
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.checkbox-item:hover {
    border-color: var(--primary-color);
    background: rgba(119, 184, 42, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(119, 184, 42, 0.15);
}

.checkbox-item input[type="checkbox"],
.checkbox-item input[type="radio"] {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.checkbox-item input[type="radio"]:checked + label,
.checkbox-item input[type="checkbox"]:checked + label {
    font-weight: 700;
    color: var(--primary-color);
}

.checkbox-item label {
    margin: 0;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    flex: 1;
}

/* Info Boxes */
.info-box {
    background: linear-gradient(135deg, var(--light-green), rgba(255,165,0,0.1));
    border: 2px solid var(--primary-color);
    border-left: 4px solid var(--primary-color);
    padding: 25px;
    margin: 25px 0;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 25px rgba(119, 184, 42, 0.1);
}

.info-box i {
    color: var(--primary-color);
    margin-right: 12px;
    font-size: 1.3rem;
}

.info-box strong {
    color: var(--primary-color);
    font-weight: 700;
}

/* Documents Section */
.documents-section {
    margin-top: 30px;
    padding: 25px;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    border: 2px solid var(--border-light);
}

.documents-section h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
}

.documents-info {
    color: var(--gray);
    margin-bottom: 25px;
    font-size: 0.95rem;
}

/* File Upload Styling */
.file-upload-container {
    position: relative;
    margin-top: 8px;
}

.file-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    border: 2px dashed var(--border-light);
    border-radius: var(--border-radius);
    background: var(--white);
    cursor: pointer;
    transition: var(--transition);
    min-height: 140px;
    text-align: center;
}

.file-upload-label:hover {
    border-color: var(--primary-color);
    background: var(--light-green);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(119, 184, 42, 0.1);
}

.file-upload-icon {
    font-size: 2.5rem;
    color: var(--gray);
    margin-bottom: 15px;
    transition: var(--transition);
}

.file-upload-label:hover .file-upload-icon {
    color: var(--primary-color);
    transform: scale(1.1);
}

.file-upload-text {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.file-upload-main {
    font-weight: 600;
    color: var(--dark-gray);
    font-size: 1rem;
}

.file-upload-sub {
    color: var(--gray);
    font-size: 0.9rem;
}

.file-upload-formats {
    color: var(--gray);
    font-size: 0.8rem;
    margin-top: 5px;
}

.file-upload-status {
    margin-top: 10px;
    padding: 10px;
    border-radius: var(--border-radius);
    display: none;
    font-size: 0.9rem;
}

.file-upload-status.success {
    display: block;
    background: var(--light-green);
    color: var(--dark-green);
    border: 1px solid var(--primary-color);
}

.file-upload-status.error {
    display: block;
    background: #fff5f5;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
}

.file-upload-progress {
    width: 100%;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.file-upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
}

.file-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    background: var(--white);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
}

.file-preview-icon {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.file-preview-info {
    flex: 1;
}

.file-preview-name {
    font-weight: 600;
    color: var(--dark-gray);
    font-size: 0.9rem;
}

.file-preview-size {
    color: var(--gray);
    font-size: 0.8rem;
}

.file-preview-remove {
    color: var(--accent-color);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: var(--transition);
}

.file-preview-remove:hover {
    background: rgba(255, 107, 53, 0.1);
}

/* Navigation Buttons */
.form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid var(--light-gray);
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(119, 184, 42, 0.3);
}

.btn-secondary {
    background: var(--border-light);
    color: var(--dark-gray);
}

.btn-secondary:hover {
    background: var(--gray);
    color: white;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Error States */
.error-message {
    color: var(--accent-color);
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 8px;
    display: none;
}

.form-group.error input,
.form-group.error select,
.form-group.error textarea {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
    background-color: #fff5f5;
}

.form-group.error .error-message {
    display: block;
}

/* Success Page */
.success-container {
    text-align: center;
    padding: 60px 40px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--box-shadow);
}

.success-icon {
    font-size: 5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    animation: bounceIn 0.8s ease-out;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.success-container h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-weight: 700;
    font-size: 2rem;
}

.success-container p {
    color: var(--gray);
    margin-bottom: 30px;
    font-size: 1.2rem;
    font-weight: 500;
}

.success-details {
    background: var(--light-green);
    padding: 25px;
    border-radius: var(--border-radius);
    margin: 30px 0;
    text-align: left;
    border: 2px solid var(--primary-color);
}

.success-details h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-weight: 700;
}

.success-details p {
    margin-bottom: 10px;
    color: var(--dark-gray);
    font-weight: 500;
}

/* Loading Spinner */
.loading-spinner {
    display: none;
    text-align: center;
    padding: 60px 40px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--box-shadow);
}

.spinner {
    border: 4px solid var(--border-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: var(--gray);
    font-size: 1.2rem;
    font-weight: 600;
}

/* Hidden Sections Animations */
#companyDetails,
.existing-loans {
    overflow: hidden;
    transition: all 0.3s ease;
}

#companyDetails.show,
.existing-loans.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 500px;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .navbar {
        padding: 0 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .logo {
        font-size: 1.5rem;
    }

    .form-header,
    .form-step,
    .progress-container {
        padding: 25px 20px;
        margin-bottom: 20px;
    }

    .form-header h1 {
        font-size: 1.8rem;
    }

    .step-title {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .step-title i {
        margin-bottom: 10px;
    }

    .progress-steps {
        flex-direction: column;
        gap: 15px;
    }

    .progress-steps::before {
        display: none;
    }

    .step {
        flex-direction: row;
        justify-content: flex-start;
    }

    .step-circle {
        margin-bottom: 0;
        margin-right: 15px;
    }

    .step-label {
        text-align: left;
        white-space: normal;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .checkbox-group {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .checkbox-item {
        padding: 15px;
    }

    .form-navigation {
        flex-direction: column;
        gap: 15px;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .success-container {
        padding: 40px 20px;
    }

    .success-icon {
        font-size: 4rem;
    }
}

@media (max-width: 480px) {
    .form-header h1 {
        font-size: 1.5rem;
    }

    .step-title {
        font-size: 1.3rem;
    }

    .checkbox-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .step-circle {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
}