:root {
    --moi-blue: #1a3d5c;
    --moi-blue-dark: #14324b;
    --moi-blue-light: #2c5a7c;
    --page-bg: #e8eef3;
    --card-bg: #ffffff;
    --border: #cfd8e3;
    --text: #1a3d5c;
    --muted: #6b7c8f;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
    background: var(--page-bg);
    color: var(--text);
    direction: rtl;
    min-height: 100vh;
}

body.is-booting {
    overflow: hidden;
}

/* ===== Page boot loader ===== */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 28, 36, 0.42);
    backdrop-filter: blur(1.5px);
    -webkit-backdrop-filter: blur(1.5px);
    transition: opacity 0.45s ease, visibility 0.45s ease;
}

.page-loader.is-hiding {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.page-loader-inner {
    text-align: center;
    padding: 20px;
}

.page-loader-bars {
    direction: ltr;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 48px;
    margin: 0 auto 18px;
}

.page-loader-bars span {
    display: block;
    width: 8px;
    height: 42px;
    border-radius: 999px;
    background: #fff;
    transform-origin: center center;
    animation: page-loader-bars 1s ease-in-out infinite;
}

.page-loader-bars span:nth-child(1) { animation-delay: 0s; }
.page-loader-bars span:nth-child(2) { animation-delay: 0.1s; }
.page-loader-bars span:nth-child(3) { animation-delay: 0.2s; }
.page-loader-bars span:nth-child(4) { animation-delay: 0.3s; }
.page-loader-bars span:nth-child(5) { animation-delay: 0.4s; }

.page-loader-text {
    margin: 0;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

@keyframes page-loader-bars {
    0%, 100% {
        transform: scaleY(0.35);
        opacity: 0.28;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* ===== Hero ===== */
.hero {
    position: relative;
    min-height: 280px;
    background: url('../assets/example.jpg') center center / cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 48px 8vw;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(10, 30, 50, 0.55) 0%, rgba(10, 30, 50, 0.25) 55%, rgba(10, 30, 50, 0.15) 100%);
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 720px;
    text-align: right;
}

.hero-title {
    margin: 0 0 12px;
    color: #fff;
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    font-weight: 800;
    line-height: 1.4;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.hero-subtitle {
    margin: 0;
    color: #fff;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    font-weight: 500;
    opacity: 0.95;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

/* ===== Inquiry section ===== */
.inquiry-section {
    background: var(--page-bg);
    padding: 36px 16px 60px;
}

.inquiry-wrap {
    max-width: 860px;
    margin: 0 auto;
}

.section-heading {
    text-align: center;
    color: var(--moi-blue);
    font-size: 1.55rem;
    font-weight: 700;
    margin: 0 0 28px;
}

/* ===== Tabs ===== */
.options-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 22px;
}

.option-card {
    background: #fff;
    border: 2px solid transparent;
    border-radius: 14px;
    padding: 28px 16px 22px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(26, 61, 92, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.option-card:hover {
    border-color: rgba(26, 61, 92, 0.35);
}

.option-card.active {
    border-color: var(--moi-blue);
    box-shadow: 0 4px 14px rgba(26, 61, 92, 0.14);
}

.option-icon-wrap {
    width: 88px;
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-icon {
    width: 78px;
    height: 78px;
    object-fit: contain;
    display: block;
}

.option-title {
    color: var(--muted);
    font-size: 1.15rem;
    font-weight: 700;
}

.option-card.active .option-title {
    color: var(--moi-blue);
}

/* ===== Form card ===== */
.form-container {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 28px 32px 32px;
    box-shadow: 0 4px 18px rgba(26, 61, 92, 0.1);
}

.form-title {
    text-align: center;
    color: var(--moi-blue);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 12px;
}

.form-divider {
    border: 0;
    border-top: 1px solid #e2e8f0;
    margin: 0 0 22px;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
}

.form-control,
.form-select {
    border-radius: 10px !important;
    border: 1px solid var(--border) !important;
    padding: 12px 14px !important;
    font-size: 1rem !important;
    color: var(--text);
    background: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--moi-blue-light) !important;
    box-shadow: 0 0 0 3px rgba(26, 61, 92, 0.12) !important;
}

/* ===== Nice custom dropdown (plate type) ===== */
.nice-select-wrap {
    position: relative;
}

.nice-select-native {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    height: 0 !important;
    width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
}

.nice-select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 12px 16px;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    user-select: none;
}

.nice-select:hover {
    border-color: #a8b8c8;
}

.nice-select.open {
    border-color: var(--moi-blue);
    box-shadow: 0 0 0 3px rgba(26, 61, 92, 0.12);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.nice-select-label {
    color: var(--text);
    font-weight: 600;
    font-size: 1rem;
    flex: 1;
    text-align: right;
}

.nice-select-arrow {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #eef3f7;
    color: var(--moi-blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
    flex-shrink: 0;
}

.nice-select.open .nice-select-arrow {
    transform: rotate(180deg);
    background: var(--moi-blue);
    color: #fff;
}

.nice-select-panel {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 50;
    background: #fff;
    border: 1px solid var(--moi-blue);
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 14px 28px rgba(26, 61, 92, 0.16);
    overflow: hidden;
}

.nice-select.open + .nice-select-panel,
.nice-select-wrap.open .nice-select-panel {
    display: block;
}

.nice-select-search {
    padding: 10px 12px;
    border-bottom: 1px solid #e8eef3;
    background: #f7fafc;
}

.nice-select-search input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 0.95rem;
    outline: none;
    font-family: inherit;
}

.nice-select-search input:focus {
    border-color: var(--moi-blue-light);
}

.nice-select-list {
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    scrollbar-width: thin;
    scrollbar-color: #b7c5d4 transparent;
}

.nice-select-list::-webkit-scrollbar {
    width: 6px;
}
.nice-select-list::-webkit-scrollbar-thumb {
    background: #b7c5d4;
    border-radius: 10px;
}

.nice-select-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text);
    font-weight: 500;
    transition: background 0.15s;
}

.nice-select-option:hover {
    background: #eef4f8;
}

.nice-select-option.selected {
    background: #e7eef5;
    color: var(--moi-blue);
    font-weight: 700;
}

.nice-select-option.selected::after {
    content: "✓";
    color: var(--moi-blue);
    font-weight: 800;
}

.nice-select-option.hidden {
    display: none;
}

.field-error {
    margin-top: 8px;
    color: #dc3545;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.5;
}

/* بدون أيقونة تعجب Bootstrap داخل الحقل */
.form-control.has-error,
.form-control.is-invalid {
    border-color: #dc3545 !important;
    box-shadow: none !important;
    background-image: none !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
}

.owner-block {
    margin-bottom: 20px;
}

.owner-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.owner-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 110px;
}

.owner-radio .form-check-input {
    width: 1.15em;
    height: 1.15em;
    margin: 0;
    cursor: pointer;
}

.owner-radio .form-check-label {
    color: var(--text);
    font-weight: 600;
    margin: 0;
    cursor: pointer;
    white-space: nowrap;
}

.owner-qid-input {
    flex: 1;
    min-width: 220px;
}

.form-check-input:checked {
    background-color: var(--moi-blue);
    border-color: var(--moi-blue);
}

/* ===== Captcha boxes (always visible layout) ===== */
.captcha-block {
    margin: 8px 0 24px;
}

.captcha-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0;
}

.captcha-block .field-error {
    margin-top: 8px;
    margin-right: 172px;
}

@media (max-width: 576px) {
    .captcha-block .field-error {
        margin-right: 0;
    }
}

.captcha-image {
    position: relative;
    width: 160px;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f4f7fa;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.captcha-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: 48px;
    object-fit: contain;
    display: none;
}

.captcha-image img.is-loaded {
    display: block;
}

.captcha-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.85rem;
    background:
        repeating-linear-gradient(
            -45deg,
            #eef2f6,
            #eef2f6 8px,
            #e6ebf1 8px,
            #e6ebf1 16px
        );
    pointer-events: none;
}

.captcha-image.has-image .captcha-placeholder {
    display: none;
}

.captcha-input {
    width: 120px !important;
    min-width: 110px;
    text-align: center;
    letter-spacing: 2px;
    font-weight: 700;
}

.btn-captcha-refresh {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--moi-blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.btn-captcha-refresh:hover {
    background: var(--moi-blue);
    color: #fff;
}

/* ===== Buttons ===== */
.button-group {
    display: flex;
    gap: 14px;
    justify-content: stretch;
    margin-top: 8px;
}

.btn-inquire,
.btn-clear {
    flex: 1;
    border-radius: 10px !important;
    font-weight: 700 !important;
    padding: 12px 20px !important;
}

.btn-primary,
.btn-inquire {
    background: var(--moi-blue) !important;
    border-color: var(--moi-blue) !important;
}

.btn-primary:hover,
.btn-inquire:hover {
    background: var(--moi-blue-dark) !important;
    border-color: var(--moi-blue-dark) !important;
}

.btn-outline-primary,
.btn-clear {
    color: var(--moi-blue) !important;
    border: 2px solid var(--moi-blue) !important;
    background: #fff !important;
}

.btn-outline-primary:hover,
.btn-clear:hover {
    background: var(--moi-blue) !important;
    color: #fff !important;
}

/* Loading */
.loading-spinner {
    text-align: center;
    padding: 40px 20px;
    background: #fff;
    border-radius: 14px;
    margin-top: 20px;
    box-shadow: 0 4px 18px rgba(26, 61, 92, 0.1);
}

.loading-spinner p {
    margin-top: 14px;
    color: var(--text);
}

/* Error modal — SweetAlert style */
.error-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.error-modal-content {
    background: #fff;
    border-radius: 6px;
    padding: 28px 24px 22px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}

.error-icon-wrap {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border: 3px solid #f27474;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: error-pop 0.35s ease;
}

.error-icon-wrap svg {
    width: 34px;
    height: 34px;
    stroke: #f27474;
    fill: none;
    stroke-width: 3.5;
    stroke-linecap: round;
}

.error-title {
    margin: 0 0 10px;
    color: #595959;
    font-size: 1.45rem;
    font-weight: 800;
}

.error-message {
    color: #797979;
    font-size: 1.02rem;
    font-weight: 500;
    margin: 0 0 24px;
    line-height: 1.7;
}

.error-close-btn {
    background: #37474f;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 11px 42px;
    min-width: 110px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    letter-spacing: 0.03em;
}

.error-close-btn:hover {
    background: #263238;
}

@keyframes error-pop {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 768px) {
    .hero {
        min-height: 220px;
        padding: 36px 20px;
    }

    .options-container {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .option-card {
        padding: 18px 8px 14px;
    }

    .option-icon-wrap {
        width: 64px;
        height: 64px;
    }

    .option-icon {
        width: 56px;
        height: 56px;
    }

    .option-title {
        font-size: 0.95rem;
    }

    .form-container {
        padding: 22px 16px;
    }

    .captcha-row {
        justify-content: center;
    }

    .button-group {
        flex-direction: column-reverse;
    }

    .owner-row {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        gap: 10px;
    }

    .owner-radio {
        justify-content: flex-start;
        min-width: auto;
    }

    .owner-qid-input {
        min-width: 0;
    }
}
