/* ===== BASE ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Override Tailwind Forms plugin defaults — must use !important to beat injected styles */
[type='text'],
[type='email'],
[type='url'],
[type='password'],
[type='number'],
[type='date'],
[type='datetime-local'],
[type='month'],
[type='search'],
[type='tel'],
[type='time'],
[type='week'],
select,
textarea {
    border-radius: 14px !important;
    border-width: 2px !important;
    border-color: #ede6f4 !important;
    background-color: #f9f7fc !important;
    font-family: 'Tajawal', sans-serif !important;
    padding: 13px 16px !important;
    font-size: 14px !important;
}

[type='text']:focus,
[type='email']:focus,
[type='url']:focus,
[type='password']:focus,
[type='number']:focus,
[type='tel']:focus,
select:focus,
textarea:focus {
    border-color: #6a21a6 !important;
    box-shadow: 0 0 0 4px rgba(106, 33, 166, 0.10), 0 2px 8px rgba(106, 33, 166, 0.06) !important;
    background-color: #fff !important;
    --tw-ring-shadow: none !important;
    --tw-ring-color: transparent !important;
}

/* Kill Tailwind Forms select arrow completely */
select {
    background-image: none !important;
}

body {
    font-family: 'Tajawal', sans-serif;
    background: #faf9fb;
    color: #150f1a;
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    margin: 0;
}

.skip-link {
    position: absolute;
    top: -40px;
    inset-inline-start: 8px;
    z-index: 100;
    background: #150f1a;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
}

.skip-link:focus {
    top: 8px;
}

/* ===== HERO HEADER ===== */
.hero-header {
    background: linear-gradient(135deg, #6a21a6 0%, #4c167a 50%, #3b0f64 100%);
    margin: 0 -16px;
    padding: 28px 20px 24px;
    position: relative;
    overflow: hidden;
}

.hero-header::before {
    content: '';
    position: absolute;
    top: -40%;
    inset-inline-end: -20%;
    width: 240px;
    height: 240px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    inset-inline-start: -10%;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-header-content {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
}

.hero-icon {
    font-size: 36px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.12);
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    flex-shrink: 0;
}

.hero-response-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ===== WHATSAPP CTA ===== */
.whatsapp-cta {
    display: block;
    margin: -12px 0 20px;
    text-decoration: none;
    position: relative;
    z-index: 2;
}

.whatsapp-cta-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border: 2px solid #e8f5e9;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(18, 140, 126, 0.12);
    transition: all 0.2s ease;
}

.whatsapp-cta:hover .whatsapp-cta-inner,
.whatsapp-cta:focus-visible .whatsapp-cta-inner {
    border-color: #25d366;
    box-shadow: 0 6px 24px rgba(18, 140, 126, 0.18);
    transform: translateY(-1px);
}

.whatsapp-cta:focus-visible .whatsapp-cta-inner {
    outline: 2px solid #128c7e;
    outline-offset: 2px;
}

.whatsapp-cta:active .whatsapp-cta-inner {
    transform: scale(0.99);
}

.whatsapp-cta-icon-wrap {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8f5e9;
    border-radius: 12px;
    flex-shrink: 0;
}

.whatsapp-cta-icon {
    width: 24px;
    height: 24px;
    color: #25d366;
}

/* ===== SECTION TITLES ===== */
.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 800;
    color: #150f1a;
    margin: 0 0 12px;
}

.section-title-icon {
    font-size: 20px;
    color: #6a21a6;
}

/* ===== QUICK ACTIONS ===== */
.quick-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px 12px;
    background: #fff;
    border: 1px solid #eee8f2;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.quick-action-card:hover {
    border-color: #d8b4fe;
    box-shadow: 0 4px 16px rgba(106, 33, 166, 0.1);
    transform: translateY(-2px);
}

.quick-action-card:active {
    transform: scale(0.97);
}

.quick-action-card:focus-visible {
    outline: 2px solid #6a21a6;
    outline-offset: 2px;
}

.quick-action-card.selected {
    border-color: #6a21a6;
    background: #faf5ff;
    box-shadow: 0 0 0 1px #6a21a6;
}

.quick-action-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    font-size: 24px;
}

.quick-action-icon .material-symbols-outlined {
    font-size: 24px;
}

.quick-action-label {
    font-size: 13px;
    font-weight: 700;
    color: #150f1a;
}

/* ===== CARD ===== */
.card {
    background: #fff;
    border: 1px solid #eee8f2;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.card-form {
    border: none;
    box-shadow: 0 4px 20px -2px rgba(106, 33, 166, 0.08);
}

.card-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid #f3ecf9;
    background: linear-gradient(180deg, #fdfbff 0%, #fff 100%);
}

.card-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 800;
    color: #6a21a6;
    margin: 0;
}

.card-header-title .material-symbols-outlined {
    font-size: 22px;
}

.card-body {
    padding: 16px 20px 20px;
}

/* ===== FORM ===== */
.form-fieldset {
    border: 0;
    margin: 0 0 20px;
    padding: 0;
}

.form-fieldset:last-of-type {
    margin-bottom: 16px;
}

.form-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #150f1a;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #eee8f2;
    width: 100%;
}

.form-legend-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #6a21a6;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #4a3560;
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

/* ---- Shared field base ---- */
.form-input {
    width: 100% !important;
    border-radius: 14px !important;
    border: 2px solid #ede6f4 !important;
    font-size: 14px !important;
    padding: 13px 16px !important;
    color: #150f1a !important;
    background-color: #f9f7fc !important;
    background-image: none !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    font-family: 'Tajawal', sans-serif !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.form-input:hover {
    border-color: #c9b0e0 !important;
    background-color: #f5f1fa !important;
}

.form-input:focus {
    outline: none !important;
    border-color: #6a21a6 !important;
    background-color: #fff !important;
    background-image: none !important;
    box-shadow: 0 0 0 4px rgba(106, 33, 166, 0.10), 0 2px 8px rgba(106, 33, 166, 0.06) !important;
    --tw-ring-shadow: none !important;
    --tw-ring-color: transparent !important;
}

.form-input::placeholder {
    color: #b5a3c7 !important;
    font-weight: 400;
}

/* ---- Select / Dropdown ---- */
select.form-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236a21a6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: left 14px center !important;
    background-size: 18px !important;
    padding-inline-start: 16px !important;
    padding-inline-end: 42px !important;
}

select.form-input:hover {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236a21a6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
}

select.form-input:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236a21a6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
}

/* Remove default arrows */
select.form-input::-ms-expand {
    display: none;
}

/* ---- Number input: hide spinners ---- */
input[type="number"].form-input::-webkit-outer-spin-button,
input[type="number"].form-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"].form-input {
    -moz-appearance: textfield;
}

/* ---- Textarea ---- */
.form-textarea {
    resize: vertical;
    min-height: 110px;
    line-height: 1.8;
}

/* ---- Spacing between fields ---- */
.form-input + .form-input,
.form-fieldset > div + div {
    margin-top: 14px;
}

.form-fieldset .grid + div {
    margin-top: 14px;
}

.form-fieldset > div:first-of-type {
    margin-top: 0;
}

/* ---- Grid gap override ---- */
.form-fieldset .grid {
    gap: 14px;
}

/* ===== ERROR / SUCCESS ===== */
.form-error {
    font-size: 13px;
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-error.hidden {
    display: none;
}

.form-success {
    border-radius: 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 14px 16px;
}

.form-success.hidden {
    display: none;
}

/* ===== SUBMIT BUTTON ===== */
.submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6a21a6 0%, #4c167a 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(106, 33, 166, 0.3);
    margin-top: 8px;
    font-family: 'Tajawal', sans-serif;
}

.submit-btn:hover {
    box-shadow: 0 6px 20px rgba(106, 33, 166, 0.4);
    transform: translateY(-1px);
}

.submit-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 10px rgba(106, 33, 166, 0.3);
}

.submit-btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    transform: none;
    box-shadow: none;
}

.submit-btn:focus-visible {
    outline: 2px solid #6a21a6;
    outline-offset: 3px;
}

/* ===== TRACK REQUEST ===== */
.track-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: auto;
    align-self: stretch;
    border-radius: 14px;
    background: linear-gradient(135deg, #6a21a6 0%, #4c167a 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(106, 33, 166, 0.2);
}

.track-btn:hover {
    background: #4c167a;
}

.track-btn:active {
    transform: scale(0.96);
}

.track-btn:focus-visible {
    outline: 2px solid #6a21a6;
    outline-offset: 2px;
}

.track-result-card {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13px;
}

.track-result-found {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.track-result-not-found {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.track-result-loading {
    background: #f5f3ff;
    border: 1px solid #e9e1f9;
    color: #6a21a6;
    text-align: center;
}

/* ===== FAQ ===== */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-item {
    background: #fff;
    border: 1px solid #eee8f2;
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.faq-item:hover {
    border-color: #d8b4fe;
}

.faq-item[open] {
    border-color: #6a21a6;
    box-shadow: 0 2px 12px rgba(106, 33, 166, 0.08);
}

.faq-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    -webkit-user-select: none;
}

.faq-summary::-webkit-details-marker {
    display: none;
}

.faq-summary:focus-visible {
    outline: 2px solid #6a21a6;
    outline-offset: -2px;
    border-radius: 14px;
}

.faq-question {
    font-size: 14px;
    font-weight: 700;
    color: #150f1a;
    line-height: 1.5;
}

.faq-chevron {
    font-size: 20px;
    color: #765492;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.faq-item[open] .faq-chevron {
    transform: rotate(180deg);
    color: #6a21a6;
}

.faq-answer {
    padding: 0 16px 14px;
    animation: faqSlideDown 0.25s ease;
}

.faq-answer p {
    font-size: 13px;
    color: #765492;
    line-height: 1.8;
    margin: 0;
}

@keyframes faqSlideDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 60;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid #eee8f2;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-item {
    flex: 1;
    min-width: 0;
    height: 68px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: #7a6a89;
    transition: all 0.2s ease;
    position: relative;
}

.bottom-nav-item.active {
    color: #6a21a6;
    font-weight: 700;
}

.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: #6a21a6;
    border-radius: 0 0 4px 4px;
}

.bottom-nav-item:active {
    transform: scale(0.96);
}

.bottom-nav-item:focus-visible {
    outline: 2px solid #6a21a6;
    outline-offset: -2px;
}

/* ===== ACCESSIBILITY ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 380px) {
    .hero-header {
        padding: 20px 16px;
    }

    .quick-action-card {
        padding: 16px 8px;
    }

    .quick-action-icon {
        width: 40px;
        height: 40px;
    }

    .card-header,
    .card-body {
        padding-inline: 16px;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== LOADING SPINNER ===== */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
