* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", "Cairo", Tahoma, Arial, sans-serif;
    background: #e9eaeb;
    color: #1d2238;
    direction: rtl;
}

/* الكوفر — aspect-ratio يتغير حسب حجم الشاشة عشان يبقى متناسب */
.cover {
    width: 100%;
    aspect-ratio: 16 / 9;        /* الموبايل: نسبة الصورة الأصلية فالصورة كاملة */
    background: #000;
    overflow: hidden;
}

.cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

@media (min-width: 600px) {
    .cover { aspect-ratio: 16 / 8; }
}

@media (min-width: 900px) {
    .cover { aspect-ratio: 16 / 7; }
}

@media (min-width: 1200px) {
    .cover {
        aspect-ratio: 16 / 6;
        max-height: 72vh;
    }
}

.page {
    max-width: 720px;
    margin: clamp(16px, 3vw, 32px) auto;
    padding: 0 clamp(12px, 3vw, 20px);
}

.form-card {
    background: #0072BC;
    color: #fff;
    border-radius: 10px;
    padding: clamp(20px, 4vw, 32px) clamp(16px, 3.5vw, 28px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

.form-title {
    text-align: center;
    margin: 0 0 clamp(16px, 3vw, 24px);
    font-size: clamp(18px, 4vw, 22px);
    font-weight: 700;
}

.field {
    margin-bottom: clamp(12px, 2.5vw, 16px);
}

.field label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
    font-size: clamp(13px, 3.4vw, 14px);
}

.field input[type="text"],
.field input[type="number"],
.field input[type="tel"],
.field input:not([type]) {
    width: 100%;
    padding: clamp(10px, 2.6vw, 13px) 14px;
    border: none;
    border-radius: 6px;
    background: #fff;
    color: #1d2238;
    font-size: 16px;          /* 16px+ يمنع iOS من zoom-in عند الـ focus */
    outline: none;
}

.field input:focus {
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.4);
}

.field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.field-row .field {
    flex: 1 1 140px;
}

.field-group-title {
    margin: 18px 0 8px;
    font-weight: 700;
    font-size: 15px;
}

.field-error {
    display: block;
    color: #ffd166;
    margin-top: 4px;
    font-size: 13px;
}

.validation-summary {
    background: rgba(255, 99, 99, 0.15);
    color: #ffd1d1;
    border: 1px solid rgba(255, 99, 99, 0.4);
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.validation-summary:empty {
    display: none;
}

.terms {
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    cursor: pointer;
}

.checkbox-label a {
    color: #ffd166;
    text-decoration: underline;
}

.submit-btn {
    display: block;
    width: 100%;
    padding: clamp(11px, 2.8vw, 14px) 16px;
    margin-top: 18px;
    background: #f5b800;
    color: #1d2238;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: clamp(15px, 3.5vw, 17px);
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}

.submit-btn:hover {
    background: #e0a800;
}

.link-btn {
    display: inline-block;
    width: auto;
    padding: 10px 22px;
}

.success-card {
    text-align: center;
}

.success-greeting {
    font-size: 18px;
    margin: 8px 0;
}

.success-note {
    margin: 8px 0;
    font-size: 15px;
}

.issued-code {
    display: inline-block;
    background: #f5b800;
    color: #1d2238;
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 2px;
    padding: 12px 22px;
    margin: 12px auto;
    border-radius: 6px;
    direction: ltr;
    user-select: all;
}

.terms-text {
    line-height: 1.8;
    font-size: 15px;
}

/* Modal popups */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: backdropFade 0.2s ease-out;
}

.modal-backdrop.hidden {
    display: none;
}

.error-list {
    text-align: right;
    margin: 12px 0 4px;
    padding: 10px 18px;
    background: #fff5f5;
    border: 1px solid #ffd1d1;
    border-radius: 8px;
    color: #c0392b;
    font-size: clamp(13px, 3.4vw, 14px);
    line-height: 1.7;
    list-style: disc;
}

.error-list li {
    margin: 2px 0;
}

.modal {
    background: #fff;
    color: #1d2238;
    border-radius: 14px;
    padding: clamp(22px, 5vw, 30px) clamp(18px, 4.5vw, 26px) clamp(18px, 4vw, 22px);
    max-width: 380px;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-icon {
    width: clamp(56px, 14vw, 72px);
    height: clamp(56px, 14vw, 72px);
    border-radius: 50%;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(30px, 8vw, 40px);
    font-weight: 700;
    color: #fff;
    animation: iconPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

/* Error modal icon */
.modal-error .modal-icon {
    background: #e74c3c;
    box-shadow: 0 6px 18px rgba(231, 76, 60, 0.4);
}

/* Error modal */
.modal-error h3 {
    margin: 0 0 8px;
    font-size: clamp(17px, 4.5vw, 20px);
    font-weight: 700;
    color: #1d2238;
}

.modal-error p {
    margin: 6px 0;
    font-size: clamp(14px, 3.6vw, 15px);
    color: #4a5568;
}

/* ===== SUCCESS MODAL ===== */
.modal-success {
    background: #ffffff;
    color: #1a1a2e;
    overflow: visible;
    padding-top: clamp(46px, 12vw, 58px);
    position: relative;
}

/* confetti container */
.success-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: 14px;
}

/* green check icon — floats above modal top */
.success-icon-wrap {
    position: absolute;
    top: clamp(-46px, -12vw, -38px);
    left: 50%;
    transform: translateX(-50%);
}

.modal-success .modal-icon {
    background: #27AE60;
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.5);
    border: 4px solid #ffffff;
    width: clamp(64px, 17vw, 80px);
    height: clamp(64px, 17vw, 80px);
    font-size: clamp(32px, 9vw, 42px);
    margin: 0;
    position: relative;
    z-index: 2;
}

.modal-success h3 {
    margin: 0 0 6px;
    font-size: clamp(32px, 10vw, 42px);
    font-weight: 900;
    color: #C8960C;
    letter-spacing: 1px;
    position: relative;
    z-index: 1;
}

.modal-success p {
    margin: 5px 0;
    font-size: clamp(14px, 3.8vw, 16px);
    color: #1a1a2e;
    font-weight: 700;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.success-sub {
    color: #1a1a2e !important;
    font-weight: 700 !important;
}

#successGreeting {
    color: #555 !important;
    font-weight: 500 !important;
    font-size: clamp(13px, 3.4vw, 14px) !important;
}

.modal-success .issued-code {
    display: block;
    background: linear-gradient(135deg, #D4A832 0%, #C89010 100%);
    border: none;
    color: #1a1a2e;
    font-size: clamp(17px, 5vw, 22px);
    font-weight: 800;
    letter-spacing: 2px;
    padding: clamp(12px, 3vw, 16px) clamp(14px, 3.5vw, 20px);
    margin: 16px 0;
    border-radius: 10px;
    direction: ltr;
    user-select: all;
    word-break: break-all;
    position: relative;
    z-index: 1;
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    position: relative;
    z-index: 1;
}

.modal-btn {
    flex: 1 1 120px;
    padding: clamp(10px, 2.8vw, 13px) 16px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: clamp(15px, 4vw, 16px);
    cursor: pointer;
    font-family: inherit;
}

/* Error modal buttons */
.modal-btn.primary {
    background: #1d3557;
    color: #fff;
}
.modal-btn.primary:hover { background: #14283f; }

.modal-btn.secondary {
    background: #f5b800;
    color: #1d2238;
}
.modal-btn.secondary:hover { background: #e0a800; }

/* Success modal buttons */
.copy-btn {
    background: linear-gradient(135deg, #D4A832, #C89010);
    color: #1a1a2e;
}
.copy-btn:hover { filter: brightness(1.08); }

.cancel-btn {
    background: #0072BC;
    color: #fff;
}
.cancel-btn:hover { background: #005fa0; }

@keyframes confettiFly {
    0%   { transform: translateY(0)    rotate(0deg);   opacity: 0.8; }
    100% { transform: translateY(-14px) rotate(200deg); opacity: 0.2; }
}

@keyframes backdropFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes iconPop {
    0% { transform: scale(0); }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.site-footer {
    background: #1d3557;
    color: #fff;
    text-align: center;
    padding: clamp(12px, 2.8vw, 16px) 12px;
    font-size: clamp(13px, 3.4vw, 14px);
}
