/* Kuleni Financial Services - Corporate Colors */
/* Based on official Kuleni logo colors */
:root {
    --kuleni-primary: #FF6B35;        /* Primary orange from logo */
    --kuleni-primary-dark: #E55A2B;   /* Darker orange for hover states */
    --kuleni-primary-light: #FF8C5A;  /* Lighter orange for accents */
    --kuleni-gray: #6B6B6B;            /* Gray for text and KULENI text */
    --kuleni-success: #10B981;         /* Green for checkmarks and success */
    --kuleni-error: #EF4444;           /* Red for errors */
    --kuleni-background: #F3F4F6;      /* Light gray background */
    --kuleni-text: #1F2937;            /* Dark gray for text */
    --kuleni-light: #f8f9fa;           /* Light background */
    --kuleni-dark: #1F2937;            /* Dark text */
}

/* General Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--kuleni-background);
    color: var(--kuleni-text);
}

.loan-application-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header and Navbar Brand Styling */
.navbar-brand {
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    min-height: 56px;
}

.app-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.app-header-title {
    color: var(--kuleni-text);
    font-weight: 600;
    font-size: 1.05rem;
    line-height: 1.2;
    white-space: normal;
    margin-left: auto;
    text-align: right;
}

.env-status-line {
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.api-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(0,0,0,0.08);
}

.api-status-checking {
    background: rgba(107,107,107,0.10);
    color: var(--kuleni-gray);
}

.api-status-online {
    background: rgba(16,185,129,0.12);
    color: var(--kuleni-success);
}

.api-status-offline {
    background: rgba(239,68,68,0.12);
    color: var(--kuleni-error);
}

.env-api-info {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--kuleni-gray);
    max-width: 80ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Kuleni Logo Styling */
.kuleni-logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 56px;
    max-height: 56px;
    flex-shrink: 0;
}

.kuleni-logo-img {
    height: 56px;
    width: auto;
    max-width: 250px;
    object-fit: contain;
    display: block;
}

.kuleni-logo-fallback {
    display: none;
    align-items: center;
    justify-content: flex-start;
    height: 56px;
    max-height: 56px;
}

.kuleni-logo-fallback svg {
    height: 56px;
    width: auto;
    max-width: 240px;
    display: block;
}

/* Responsive logo sizing */
@media (max-width: 768px) {
    .kuleni-logo {
        height: 48px;
        max-height: 48px;
    }
    
    .kuleni-logo-img {
        height: 48px;
        max-width: 200px;
    }
    
    .kuleni-logo-fallback {
        height: 48px;
        max-height: 48px;
    }
    
    .kuleni-logo-fallback svg {
        height: 48px;
        max-width: 200px;
    }
    .app-header-title {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    /* On small screens, hide the logo to keep the header clean */
    .navbar-brand {
        display: none;
    }

    .app-header {
        justify-content: flex-end;
    }

    .kuleni-logo {
        height: 44px;
        max-height: 44px;
    }
    
    .kuleni-logo-img {
        height: 44px;
        max-width: 180px;
    }
    
    .kuleni-logo-fallback {
        height: 44px;
        max-height: 44px;
    }
    
    .kuleni-logo-fallback svg {
        height: 44px;
        max-width: 180px;
    }
    .app-header-title {
        font-size: 0.95rem;
        flex-basis: 100%;
    }
}

/* Stepper Styles */
.stepper-wrapper {
    margin: 40px 0;
}

.stepper-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin-bottom: 30px;
}

.stepper-container::before {
    content: '';
    position: absolute;
    top: 25px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #dee2e6;
    z-index: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.step-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #dee2e6;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    border: 3px solid #dee2e6;
}

.step-label {
    font-size: 12px;
    color: #6c757d;
    text-align: center;
    font-weight: 500;
}

.step.active .step-number {
    background-color: var(--kuleni-primary);
    color: white;
    border-color: var(--kuleni-primary);
    box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.2);
}

.step.completed .step-number {
    background-color: var(--kuleni-success);
    color: white;
    border-color: var(--kuleni-success);
}

.step.completed .step-number::after {
    content: '✓';
    font-size: 24px;
}

.step.invalid .step-number {
    background-color: var(--kuleni-error);
    color: transparent;
    border-color: var(--kuleni-error);
}

.step.invalid .step-number::after {
    content: '✗';
    font-size: 24px;
    color: white;
}

.step.invalid .step-label {
    color: var(--kuleni-error);
    font-weight: 600;
}

.step.active .step-label {
    color: var(--kuleni-primary);
    font-weight: 600;
}

/* Disabled step styling */
.step.disabled .step-number {
    opacity: 0.5;
    cursor: not-allowed !important;
    background-color: #dee2e6;
    color: #6c757d;
    border-color: #dee2e6;
}

.step.disabled .step-label {
    color: #6c757d;
    opacity: 0.5;
}

/* Clickable step number hover effect */
.step .step-number:hover:not(.disabled) {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

.step.disabled .step-number:hover {
    transform: none;
    cursor: not-allowed !important;
}

.step.completed .step-label {
    color: var(--kuleni-success);
}

/* Form Styles */
.card {
    border: none;
    border-radius: 10px;
}

/* Step 6: Supporting documents (polished card grid) */
#step-6 .attachments-section {
    background: #ffffff;
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: 16px;
    padding: 16px;
}

#step-6 .attachments-section .card {
    border: 1px solid rgba(17, 24, 39, 0.10);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 10px 26px rgba(17, 24, 39, 0.08);
    transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#step-6 .attachments-section .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(17, 24, 39, 0.12);
    border-color: rgba(255, 107, 53, 0.30);
}

#step-6 .attachments-section .card-body {
    flex: 1;
    padding: 16px;
}

#step-6 .attachments-section .card-footer {
    padding: 0 16px 16px;
}

#step-6 .attachments-section .fw-semibold {
    line-height: 1.25;
}

#step-6 .attachments-section .badge {
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

#step-6 .attachments-section input[type="file"].form-control {
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
}

#step-6 .attachments-section [id^="doc-status-"] {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(17, 24, 39, 0.12);
    background: rgba(243, 244, 246, 0.9);
    font-weight: 600;
}

#step-6 .attachments-section [id^="doc-status-"]::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.85;
}

#step-6 .attachments-section [id^="doc-status-"].text-success {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
    color: #065F46;
}

#step-6 .attachments-section [id^="doc-status-"].text-danger {
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.35);
    color: #991B1B;
}

#step-6 .attachments-section [id^="doc-status-"].text-muted {
    background: rgba(243, 244, 246, 0.95);
    border-color: rgba(17, 24, 39, 0.10);
    color: #6B7280;
}

#step-6 .attachments-section .btn {
    border-radius: 12px;
}

.form-label {
    font-weight: 500;
    color: var(--kuleni-dark);
    margin-bottom: 8px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--kuleni-primary);
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 53, 0.25);
}

.btn-primary {
    background-color: var(--kuleni-primary);
    border-color: var(--kuleni-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--kuleni-primary-dark);
    border-color: var(--kuleni-primary-dark);
    color: white;
}

.btn-primary:focus {
    background-color: var(--kuleni-primary-dark);
    border-color: var(--kuleni-primary-dark);
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 53, 0.5);
}

.btn-success {
    background-color: var(--kuleni-success);
    border-color: var(--kuleni-success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #218838;
    border-color: #1e7e34;
    color: white;
}

.btn-success:disabled,
.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-enabled {
    background-color: var(--kuleni-success);
    border-color: var(--kuleni-success);
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.scroll-indicator {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Required field indicators */
.form-label:has(+ input[required]),
.form-label:has(+ select[required]),
.form-label:has(+ textarea[required])::after {
    content: ' *';
    color: var(--kuleni-error);
    font-weight: bold;
}

/* Introduction and Purpose sections */
.introduction-section {
    border-left: 4px solid var(--kuleni-primary);
}

.purpose-section {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    background-color: #ffffff;
}

.co-applicant-toggle {
    border: 2px solid var(--kuleni-primary-light);
    border-radius: 8px;
}

.co-applicant-question {
    margin-top: 40px;
}

.co-applicant-question .form-check {
    transition: all 0.3s ease;
}

.co-applicant-question .form-check:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#coApplicantYesContainer,
#coApplicantNoContainer {
    transition: all 0.3s ease;
}

#coApplicantYesContainer:hover,
#coApplicantNoContainer:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Currency input group styling */
.input-group-text {
    background-color: var(--kuleni-primary);
    color: white;
    font-weight: 500;
    border-color: var(--kuleni-primary);
}

.currency-input {
    font-weight: 500;
}

/* Terms & Conditions Checkbox Styling */
.terms-acknowledgment {
    border: 2px solid #dee2e6;
    transition: border-color 0.3s;
    background-color: #F9FAFB;
}

.terms-acknowledgment .form-check-input:disabled,
.terms-acknowledgment .form-check-input.disabled-checkbox {
    cursor: not-allowed !important;
    opacity: 0.5;
    pointer-events: none;
}

.terms-acknowledgment .form-check-input:not(:disabled) {
    cursor: pointer;
    width: 20px;
    height: 20px;
}

.terms-acknowledgment .form-check-input:checked {
    background-color: var(--kuleni-success);
    border-color: var(--kuleni-success);
}

/* Review (Step 8) - Stepper-style preview */
.review-stepper-sections {
    display: block;
}

.review-step-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.review-step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: linear-gradient(90deg, rgba(255, 107, 53, 0.12), rgba(16, 185, 129, 0.08));
    border-bottom: 1px solid #f1f5f9;
}

.review-step-title {
    font-weight: 700;
    color: var(--kuleni-text);
}

.review-step-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
}

.review-step-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.14);
    color: #065f46;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid rgba(16, 185, 129, 0.25);
    white-space: nowrap;
}

.review-step-body {
    padding: 16px 18px;
}

.review-kv-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 768px) {
    .review-kv-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.review-kv {
    border: 1px solid #f1f5f9;
    background: #fafafa;
    border-radius: 12px;
    padding: 12px;
}

.review-k {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 6px;
}

.review-v {
    font-weight: 600;
    color: var(--kuleni-text);
    word-break: break-word;
}

.review-highlight {
    border: 1px solid rgba(255, 107, 53, 0.25);
    background: rgba(255, 107, 53, 0.06);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 14px;
}

.review-highlight-title {
    font-weight: 700;
    color: var(--kuleni-primary-dark);
    margin-bottom: 8px;
}

.review-highlight-list {
    margin: 0;
    padding-left: 18px;
    color: var(--kuleni-text);
}

.review-attachments {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 768px) {
    .review-attachments {
        grid-template-columns: 1fr 1fr;
    }
}

.review-attachment {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    background: #ffffff;
}

.review-attachment-name {
    font-weight: 700;
    color: var(--kuleni-text);
}

.review-attachment-meta {
    color: #6b7280;
    font-size: 0.85rem;
}

.review-signature-img {
    max-width: 320px;
    max-height: 160px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
    padding: 6px;
}

.terms-acknowledgment .form-check-label {
    font-size: 16px;
    color: #1F2937;
    cursor: pointer;
}

.terms-acknowledgment .form-check-input:disabled + .form-check-label {
    color: #9CA3AF;
    cursor: not-allowed;
}

#termsStatusMessage {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

#scrollStatus.text-warning {
    color: #F59E0B;
}

#scrollStatus.text-success {
    color: #10B981;
    font-weight: 600;
}

/* Terms Content Scrollable Container */
.terms-content {
    height: 400px;
    overflow-y: auto;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    padding: 20px;
    background-color: #F9FAFB;
}

.terms-content::-webkit-scrollbar {
    width: 8px;
}

.terms-content::-webkit-scrollbar-track {
    background: #F3F4F6;
    border-radius: 4px;
}

.terms-content::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 4px;
}

.terms-content::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* Phone Input Wrapper */
.phone-input-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.phone-prefix {
    background-color: var(--kuleni-gray);
    color: white;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--kuleni-gray);
    border-right: none;
    border-radius: 0.375rem 0 0 0.375rem;
    font-weight: 500;
    user-select: none;
    white-space: nowrap;
}

.phone-input-wrapper .form-control {
    border-left: none;
    border-radius: 0 0.375rem 0.375rem 0;
    padding-left: 0.5rem;
}

.phone-input-wrapper .form-control:focus {
    border-left: 1px solid var(--kuleni-primary);
    padding-left: calc(0.5rem - 1px);
}

/* Validation success/error icons */
.is-valid {
    border-color: var(--kuleni-success) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2310B981' d='m2.3 6.73.98-.98-.98-.98-.98.98.98.98zm2.12-2.12L4.14 4.14l-.98-.98-.98.98.98.98z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.is-invalid {
    border-color: var(--kuleni-error) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23EF4444'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6.2.2.2-.2M6 8.5V6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

/* Terms and Conditions Container */
.terms-container {
    margin-bottom: 20px;
}

.terms-content {
    height: 400px;
    overflow-y: auto;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    padding: 20px;
    background-color: #F9FAFB;
    line-height: 1.8;
}

.terms-content h5 {
    color: var(--kuleni-primary);
    margin-bottom: 20px;
    font-weight: 600;
}

/* Section headers - apply Kuleni branding */
.step-content h4 {
    color: var(--kuleni-primary);
    font-weight: 600;
    border-bottom: 2px solid var(--kuleni-primary-light);
    padding-bottom: 10px;
    margin-bottom: 25px;
}

.terms-content h6 {
    color: var(--kuleni-dark);
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: 600;
}

.terms-content p {
    margin-bottom: 15px;
    color: #495057;
}

.terms-content ul {
    margin-bottom: 15px;
    padding-left: 25px;
}

.terms-content li {
    margin-bottom: 8px;
    color: #495057;
}

/* Step Content */
.step-content {
    min-height: 400px;
    animation: fadeIn 0.3s ease-in;
}

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

/* Validation Styles */
.text-danger {
    font-size: 0.875rem;
    margin-top: 5px;
}

.is-invalid {
    border-color: var(--kuleni-error);
}

.is-valid {
    border-color: var(--kuleni-success);
}

/* Validation indicators */
.field-valid::after {
    content: '✓';
    color: var(--kuleni-success);
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.field-invalid::after {
    content: '✗';
    color: var(--kuleni-error);
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* Responsive Design */
@media (max-width: 768px) {
    .stepper-container {
        flex-wrap: wrap;
    }

    .step {
        flex: 0 0 33.333%;
        margin-bottom: 20px;
    }

    .step-label {
        font-size: 10px;
    }

    .step-number {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .loan-application-container {
        padding: 10px;
    }
}

/* Alert Styles */
.alert {
    border-radius: 8px;
    border: none;
}

.alert-info {
    background-color: #e7f3ff;
    color: #004085;
}

/* Navigation Buttons */
.d-flex.justify-content-between {
    gap: 10px;
}

.btn {
    min-width: 120px;
    padding: 10px 20px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.3s ease;
}

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

/* Footer */
footer {
    margin-top: 60px;
}

