* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #F4F6F9;
    /* light gray background */
    /* font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; */
    color: #1E2A3A;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Enterprise color palette */
:root {
    --primary: #0B2A4A;
    /* navy */
    --primary-dark: #071D34;
    --secondary: #4A5568;
    /* dark gray */
    --background: #F4F6F9;
    --surface: #FFFFFF;
    --border-light: #E0E0E0;
    --border-focus: #2B6A9E;
    /* accessible blue */
    --error: #B22234;
    /* dark red */
    --error-light: #FCE9E9;
    --success: #2C6B2F;
    /* muted green */
    --success-light: #E9F3E9;
    --text-primary: #1E2A3A;
    --text-secondary: #3E4E62;
    --text-muted: #5F6B7A;
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* layout containers */
.app-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ------ top navigation (corporate) ------ */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 32px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    background: var(--primary);
    color: white;
    width: 60px;
    height: 40px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 600;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.3px;
}

.badge {
    background: #EDF2F7;
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 30px;
    font-weight: 500;
}

/* ------ page header with legal line ------ */
.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.legal-consent {
    background: #F9FAFC;
    border-left: 4px solid var(--primary);
    padding: 14px 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-radius: 0 4px 4px 0;
    line-height: 1.6;
}

/* ------ section card (white surface) ------ */
.form-section {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 28px 30px;
    margin-bottom: 28px;
    box-shadow: var(--shadow);
}

.section-header {
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 12px;
}

.section-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header i {
    color: var(--primary);
    font-size: 1.2rem;
}

/* form field grid */
.field-group {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
}

.field-group:last-child {
    margin-bottom: 0;
}

.field-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.required-star {
    color: var(--error);
    font-size: 1.2rem;
    line-height: 1;
    margin-left: 2px;
}

/* input style (outlined, label above) */
.input-corporate {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    background: white;
    transition: border 0.1s;
    font-family: 'IBM Plex Sans Arabic', sans-serif !important;
    /* font-family: 'Inter', sans-serif; */
}

.input-corporate:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 1px var(--border-focus);
}

.input-corporate.error {
    border-color: var(--error);
    background-color: var(--error-light);
}

/* error text (only shown after validation) */
.error-text {
    font-size: 0.8rem;
    color: var(--error);
    font-weight: 500;
    margin-top: 6px;
    min-height: 20px;
}

/* ----- dropify restyle (enterprise) ----- */
.corporate-upload .dropify-wrapper {
    border: 1px solid var(--border-light) !important;
    border-radius: 4px !important;
    background: white !important;
    padding: 16px !important;
    /* font-family: 'Inter', sans-serif !important; */
    box-shadow: none !important;
}

.corporate-upload .dropify-wrapper:hover {
    border-color: #B0C0D0 !important;
    background: #FCFDFF !important;
}

.corporate-upload .dropify-message span {
    color: var(--text-secondary) !important;
    font-size: 0.9rem !important;
}

.corporate-upload .dropify-preview {
    background: white !important;
}

.corporate-upload .dropify-render img {
    border-radius: 4px !important;
}

.corporate-upload .dropify-errors-container {
    background: var(--error-light) !important;
    color: var(--error) !important;
    border-radius: 2px !important;
    border: 1px solid var(--error) !important;
    font-size: 0.8rem !important;
}

/* error state for dropify (we'll add class to wrapper) */
.dropify-wrapper.error {
    border-color: var(--error) !important;
    background: var(--error-light) !important;
}

/* ----- signature section (clean, white) ----- */
.signature-container {
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 5px;
    background: white;
}

.signature-canvas {
    display: block;
    width: 100%;
    height: 200px;
    background: white;
    border: 1px solid #E8ECF2;
    border-radius: 4px;
    cursor: crosshair;
    touch-action: none;
}

.signature-container.error-border {
    border-color: var(--error);
    background: var(--error-light);
}

.clear-btn {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 8px 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.1s, border 0.1s;
    font-family: 'IBM Plex Sans Arabic', sans-serif !important;

}

.clear-btn:hover {
    background: #F2F5F9;
    border-color: #B0C0D0;
}

/* ----- form actions & submit button ----- */
.form-actions {
    display: flex;
    justify-content: flex-end;
    margin: 16px 0 40px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 14px 42px;
    font-weight: 600;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.1s;
    box-shadow: 0 2px 4px rgba(0, 20, 40, 0.2);
    font-family: 'IBM Plex Sans Arabic', sans-serif !important;

}

.btn-primary:hover {
    background: var(--primary-dark);
}

/* footer legal note */
.footer-note {
    border-top: 1px solid var(--border-light);
    padding: 24px 0;
    margin-top: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ----- enterprise toast (top-right, fade only) ----- */
.enterprise-toast {
    position: fixed;
    top: 30px;
    right: 30px;
    background: var(--surface);
    border-left: 6px solid var(--primary);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    padding: 16px 24px;
    min-width: 300px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.15s, transform 0.15s;
    pointer-events: none;
}

.enterprise-toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.enterprise-toast.success {
    border-left-color: var(--success);
}

.enterprise-toast.error {
    border-left-color: var(--error);
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 4px;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* responsive */
@media (max-width: 600px) {
    .form-section {
        padding: 20px;
    }

    .navbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* CUSTOM SEARCHABLE SELECT STYLES */

.custom-select-container {
    position: relative;
    width: 100%;
    /* font-family: 'Inter', sans-serif; */
}

/* Trigger button (looks exactly like input-corporate) */
.custom-select-trigger {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
    border: 1px solid var(--border-light, #E0E0E0);
    border-radius: 4px;
    background: white;
    color: #1E2A3A;
    cursor: pointer;
    transition: border 0.1s, box-shadow 0.1s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 2;
}

.custom-select-trigger i {
    color: #5F6B7A;
    font-size: 0.9rem;
    transition: transform 0.2s;
}

.custom-select-container.open .custom-select-trigger i {
    transform: rotate(180deg);
}

.custom-select-container.open .custom-select-trigger {
    border-color: #2B6A9E;
    box-shadow: 0 0 0 1px #2B6A9E;
}

.custom-select-trigger.error {
    border-color: #B22234;
    background-color: #FCE9E9;
}

/* Dropdown options panel */
.custom-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-light, #E0E0E0);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 320px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}

.custom-select-container.open .custom-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Search box */
.search-box {
    padding: 12px;
    border-bottom: 1px solid var(--border-light, #E0E0E0);
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 24px;
    color: #8A9AA8;
    font-size: 0.9rem;
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-light, #E0E0E0);
    border-radius: 4px;
    font-size: 0.9rem;
    /* font-family: 'Inter', sans-serif; */
    font-family: 'IBM Plex Sans Arabic', sans-serif !important;
    transition: border 0.1s;
}

.search-box input:focus {
    outline: none;
    border-color: #2B6A9E;
}

/* Options list */
.options-list {
    overflow-y: auto;
    max-height: 220px;
    padding: 4px 0;
}

/* Individual option */
.option {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #1E2A3A;
    transition: background-color 0.1s;
    /* font-family: 'Inter', 'Tahoma', 'Arial', sans-serif; */
}

.option:hover {
    background-color: #F0F5FF;
}

.option.selected {
    background-color: #E3F0FF;
    color: #0B2A4A;
    font-weight: 500;
    position: relative;
}

.option.selected::before {
    content: "✓";
    margin-right: 8px;
    color: #0B2A4A;
}

/* No results message */
.no-results {
    padding: 16px;
    text-align: center;
    color: #8A9AA8;
    font-size: 0.9rem;
    display: none;
}

/* RTL support */
html[dir="rtl"] .search-box i {
    left: auto;
    right: 24px;
}

html[dir="rtl"] .search-box input {
    padding: 8px 36px 8px 12px;
}

html[dir="rtl"] .option.selected::before {
    margin-right: 0;
    margin-left: 8px;
}

/* Error state for container */
.custom-select-container.error .custom-select-trigger {
    border-color: #B22234;
    background-color: #FCE9E9;
}

.dropify-font-upload:before,
.dropify-wrapper .dropify-message span.file-icon:before {
    font-size: 3rem !important;
}

#loader-container {
    position: fixed;
    background: #f7fbfde0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99;

}

#loader-container .ac-spinner{
    width:70px;
    height: 70px;
}

/* ===============================
   Loading Overlay
================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: opacity .25s ease;
}

.loading-overlay.show {
    visibility: visible;
    opacity: 1;
}

.loading-box {
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #0B2A4A;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: auto;
}

.loading-text {
    margin-top: 12px;
    font-weight: 600;
    color: #0B2A4A;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}