/**
 * Thin overlay only — visual design comes from Shubeik:
 * /assets/lib/bootstrap/.../bootstrap.min.css
 * /assets/css/style.css
 *
 * Keep this file small: isolation + CV-only widgets.
 */

#cv-app {
    --sb-red: #cc0000;
    --sb-navy: #02204a;
    --sb-line: #e8ecf2;
    --sb-soft: #f7f8ff;
    isolation: isolate;
    position: relative;
    z-index: 1;
}

#cv-app.cv-embed {
    padding-bottom: 2rem;
}

#cv-app .cv-shell {
    max-width: 1080px;
    margin: 0 auto;
}

#cv-app a.cv-lang-toggle {
    display: inline-flex;
    align-items: center;
    color: #cc0000 !important;
    background: transparent;
    border: 1.5px solid #cc0000;
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
    text-decoration: none !important;
    white-space: nowrap;
}

#cv-app a.cv-lang-toggle:hover,
#cv-app a.cv-lang-toggle:focus {
    color: #fff !important;
    background: #cc0000;
    text-decoration: none !important;
}

#cv-app .cv-stepper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

#cv-app .cv-step {
    flex: 1;
    min-width: 110px;
    text-align: center;
    padding: 0.55rem 0.75rem;
    border-radius: 50px;
    border: 1px solid var(--sb-line);
    background: var(--sb-soft);
    color: #6c7480;
    font-size: 0.85rem;
    font-weight: 700;
}

#cv-app .cv-step.is-active {
    background: var(--sb-red);
    border-color: var(--sb-red);
    color: #fff;
}

#cv-app .cv-step.is-done {
    background: rgba(204, 0, 0, 0.08);
    border-color: transparent;
    color: var(--sb-red);
}

#cv-app .cv-section {
    background: #fff;
    border: 1px solid var(--sb-line);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
    padding: 1.25rem 1.35rem;
    margin-bottom: 1.15rem;
}

#cv-app .cv-section h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #2d3137;
    margin: 0 0 0.85rem;
    padding-bottom: 0.55rem;
    border-bottom: 2px solid rgba(204, 0, 0, 0.1);
}

#cv-app .entry-card {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    background: var(--sb-soft);
    border: 1px solid var(--sb-line);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.85rem;
}

#cv-app .entry-card .entry-main {
    flex: 1;
    min-width: 0;
}

#cv-app .entry-card .remove-btn {
    flex: 0 0 auto;
    align-self: flex-start;
    box-sizing: border-box;
    width: 38px;
    height: 38px;
    margin: 0;
    margin-top: 2rem; /* align with first input under label */
    padding: 0;
    border: 1px solid #f0c0c0;
    border-radius: 8px;
    background: #fff5f5;
    color: var(--sb-red);
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#cv-app .entry-card .remove-btn:hover {
    background: #ffe8e8;
    border-color: #cc0000;
}

/* Optical center for the × glyph (baseline sits slightly low) */
#cv-app .entry-card .remove-btn > span {
    display: block;
    line-height: 1;
    transform: translateY(-0.05em);
}

#cv-app .photo-preview {
    width: 88px;
    height: 88px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid var(--sb-red);
    display: none;
}

#cv-app .photo-preview.is-visible {
    display: block;
}

/* Choice cards — neutralize host radio/label decorations */
#cv-app .cv-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

#cv-app label.cv-choice {
    position: relative !important;
    display: block !important;
    cursor: pointer !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    min-height: 0 !important;
}

#cv-app label.cv-choice::before,
#cv-app label.cv-choice::after,
#cv-app label.cv-choice .choice-face::before,
#cv-app label.cv-choice .choice-face::after,
#cv-app label.cv-choice input::before,
#cv-app label.cv-choice input::after {
    content: none !important;
    display: none !important;
}

#cv-app label.cv-choice > input[type="radio"] {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    opacity: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    pointer-events: none !important;
}

#cv-app label.cv-choice .choice-face {
    display: block !important;
    border: 1.5px solid var(--sb-line) !important;
    border-radius: 10px !important;
    background: #fff !important;
    padding: 1rem !important;
    margin: 0 !important;
    box-shadow: none !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#cv-app label.cv-choice:hover .choice-face,
#cv-app label.cv-choice > input[type="radio"]:checked + .choice-face,
#cv-app label.cv-choice.is-selected .choice-face {
    border-color: var(--sb-red) !important;
    box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.12) !important;
}

#cv-app .choice-face strong {
    display: block;
    margin-bottom: 0.2rem;
    color: #2d3137;
}

#cv-app .choice-face p {
    margin: 0;
    color: #6c7480;
    font-size: 0.9rem;
}

#cv-app .color-theme-grid {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 0.5rem;
}

#cv-app .color-theme-card {
    display: block;
    cursor: pointer;
    margin: 0;
}

#cv-app .color-theme-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}

#cv-app .color-theme-face {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.45rem 0.35rem;
    border: 1.5px solid transparent;
    border-radius: 8px;
    text-align: center;
}

#cv-app .color-theme-face.is-light {
    border-color: #c5cdd8;
}

#cv-app .color-theme-card:hover .color-theme-face,
#cv-app .color-theme-card.is-selected .color-theme-face,
#cv-app .color-theme-card input:checked + .color-theme-face {
    box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.18);
    border-color: var(--sb-red);
}

#cv-app .color-theme-face strong {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
}

#cv-app .color-theme-face strong.on-dark {
    color: #fff;
}

#cv-app .color-theme-face strong.on-light {
    color: #2d3137;
}

#cv-app .cv-preview-wrap {
    background: #f7f7f7;
    border-radius: 10px;
    padding: 1rem;
    overflow: auto;
}

#cv-app .cv-preview-page {
    width: min(100%, 794px);
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 12px 40px rgba(2, 32, 74, 0.12);
    overflow: hidden;
}

#cv-app .cv-preview-page .cv-navy {
    padding: 0;
    overflow: hidden;
}

#cv-app .cv-preview-page .cv-navy img {
    border-radius: 0 !important;
}

#cv-app .cv-thank-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
}

#cv-app .cv-thank-id-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1.25rem;
    border: 1px dashed #d7dde8;
    border-radius: 12px;
    background: #f7f8ff;
    min-width: min(100%, 320px);
}

#cv-app .cv-thank-id-label {
    color: #6c7480;
    font-size: 0.85rem;
    font-weight: 600;
}

#cv-app .cv-thank-id {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .75rem 1rem;
}

#cv-app .cv-returning-alt {
    padding: 1rem;
    border: 1px solid var(--sb-line);
    border-radius: 12px;
    background: #fff;
}

#cv-app .cv-password-gate {
    max-width: 640px;
    margin-inline: auto;
    border: 1px solid var(--sb-line);
    border-radius: 12px;
    padding: 1.1rem 1.2rem;
    background: #fff;
    text-align: start;
    direction: inherit;
}

#cv-app[dir="rtl"] .cv-password-gate {
    direction: rtl;
    text-align: right;
}

#cv-app[dir="ltr"] .cv-password-gate {
    direction: ltr;
    text-align: left;
}

#cv-app .cv-password-gate-title {
    color: #cc0000;
    text-align: inherit;
}

#cv-app .cv-password-gate-text,
#cv-app .cv-password-gate-hint {
    line-height: 1.8;
    text-align: inherit;
}

#cv-app .cv-password-gate-actions {
    text-align: inherit;
}

#cv-app .banner-slot {
    margin-top: 1.5rem;
    border-radius: 10px;
    background: #e0ebfa;
    border: 1px dashed var(--sb-line);
    min-height: 80px;
    display: grid;
    place-items: center;
    color: #6c7480;
    font-weight: 700;
}

#cv-app .cv-phone-field {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    background: #fff;
    overflow: visible;
    /* Always LTR: flag + dial, then national number (AR + EN) */
    direction: ltr;
    unicode-bidi: isolate;
}

#cv-app .cv-phone-field.is-invalid {
    border-color: #cc0000;
}

#cv-app .cv-phone-cc {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
    border: 0;
    border-right: 1px solid #e5e7eb;
    border-radius: 0.3rem 0 0 0.3rem;
    background: #f1f3f7;
    padding: 0.45rem 0.65rem;
    cursor: pointer;
    color: #2d3137;
    font-weight: 700;
    line-height: 1.2;
    direction: ltr;
}

#cv-app .cv-phone-flag {
    font-size: 1.25rem;
    line-height: 1;
}

#cv-app .cv-phone-code {
    direction: ltr;
    unicode-bidi: isolate;
    font-size: 0.95rem;
}

#cv-app .cv-phone-caret {
    font-size: 0.7rem;
    color: #6c7480;
}

#cv-app .cv-phone-national {
    border: 0 !important;
    box-shadow: none !important;
    /* Outer right corners — fixes the “cut off” edge */
    border-radius: 0 0.3rem 0.3rem 0 !important;
    flex: 1 1 auto;
    min-width: 0;
    direction: ltr;
    text-align: left;
    background: transparent !important;
}

/* Arabic only: placeholder on the right; typed digits stay left like English */
#cv-app[dir="rtl"] .cv-phone-national:placeholder-shown {
    text-align: right;
}

#cv-app .cv-phone-dropdown {
    position: absolute;
    left: 0;
    right: auto;
    top: calc(100% + 4px);
    z-index: 40;
    width: min(100%, 360px);
    background: #fff;
    border: 1px solid #e8ecf2;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    padding: 0.55rem;
    direction: ltr;
    text-align: left;
}

#cv-app .cv-phone-search {
    margin-bottom: 0.45rem;
}

#cv-app .cv-phone-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 240px;
    overflow: auto;
}

#cv-app .cv-phone-option {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
}

#cv-app .cv-phone-option:hover {
    background: #f7f8ff;
}

#cv-app .cv-phone-option-flag {
    font-size: 1.2rem;
    line-height: 1;
}

#cv-app .cv-phone-option-name {
    flex: 1 1 auto;
    min-width: 0;
}

#cv-app .cv-phone-option-dial {
    color: #6c7480;
    font-weight: 600;
    direction: ltr;
    unicode-bidi: isolate;
}

#cv-app .form-control.is-invalid {
    border-color: #cc0000 !important;
}

#cv-app .invalid-feedback {
    display: none;
    color: #cc0000 !important;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

#cv-app .form-control.is-invalid ~ .invalid-feedback,
#cv-app .was-validated .form-control:invalid ~ .invalid-feedback,
#cv-app .invalid-feedback.is-visible {
    display: block !important;
}

#cv-app .cv-publish-consent {
    margin-top: 0.35rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--sb-line);
    border-radius: 12px;
    background: #fff;
}

#cv-app .cv-publish-label {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin: 0;
    cursor: pointer;
    line-height: 1.7;
}

#cv-app .cv-publish-label input {
    margin-top: 0.35rem;
    flex-shrink: 0;
    width: 1.1rem;
    height: 1.1rem;
    accent-color: #cc0000;
}

#cv-app .cv-publish-badge {
    color: #cc0000;
    font-weight: 800;
    margin-inline-end: 0.35rem;
}

#cv-app .cv-publish-rest {
    color: #2d3137;
}

#cv-app .cv-publish-agree {
    color: #2d3137;
    font-weight: 700;
    margin-inline-start: 0.25rem;
}

/* Standalone fallback if site CSS failed to load */
body.app-body:not(.cv-embed) {
    margin: 0;
    font-family: "Cairo", sans-serif;
    color: #2d3137;
    background: #fff;
}

@media (max-width: 900px) {
    #cv-app .color-theme-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 800px) {
    #cv-app .cv-choice-grid {
        grid-template-columns: 1fr;
    }

    #cv-app .color-theme-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
