/* ===================================================
   OSTORE — Support Contact Modal / Bottom Sheet
   Loaded globally (all pages)
   =================================================== */

/* Prevent scroll when modal is open */
body.ostore-modal-open {
    overflow: hidden;
}

/* ── Modal Root ──────────────────────────────────── */
#ostore-support-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#ostore-support-modal.is-open {
    pointer-events: all;
    opacity: 1;
}

/* ── Overlay ─────────────────────────────────────── */
.ostore-support-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* ── Panel / Drawer ──────────────────────────────── */
.ostore-support-panel {
    position: relative;
    z-index: 1;
    background: #fff;
    width: 100%;
    max-width: 480px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 28px 24px 32px;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.12);
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#ostore-support-modal.is-open .ostore-support-panel {
    transform: translateY(0);
}

/* Drag handle indicator */
.ostore-support-panel::before {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    background: #e5e7eb;
    border-radius: var(--radius-sm);
    margin: 0 auto 20px;
}

/* ── Close Button ────────────────────────────────── */
.ostore-support-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    background: #f3f4f6;
    border: none;
    border-radius: var(--radius-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    transition: background 0.2s ease, color 0.2s ease;
    padding: 0;
    line-height: 1;
}

.ostore-support-close:hover {
    background: #e5e7eb;
    color: #111827;
}

.ostore-support-close svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* ── Header ──────────────────────────────────────── */
.ostore-support-header {
    margin-bottom: 20px;
    padding-right: 36px;
}

.ostore-support-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: #111827;
    margin: 0 0 5px;
    line-height: 1.2;
}

.ostore-support-header p {
    font-size: 0.85rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

/* ── Form ────────────────────────────────────────── */
#ostore-support-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Input Groups (matching contact support) ── */
.ostore-support-input-group {
    display: flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md, 8px);
    background: var(--color-bg-white);
    height: 40px;
    padding: 0 12px;
    transition: border-color var(--transition-fast, 0.15s ease), box-shadow var(--transition-fast, 0.15s ease);
    box-sizing: border-box;
}

.ostore-support-input-group:focus-within {
    border-color: var(--color-primary, var(--color-sale));
    box-shadow: var(--shadow-focus-ring);
}

.ostore-support-input-group.has-error {
    border-color: #dc2626 !important;
}

/* ── Icon Section ────────────────────────────────── */
.ostore-support-input-group .ostore-field-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: var(--color-text-light);
    flex-shrink: 0;
}

.ostore-support-input-group .ostore-field-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    flex-shrink: 0;
}

/* Phone Field Specifics */
.ostore-support-input-group.ostore-phone-input-container {
    padding-left: 10px;
}

.ostore-support-input-group .ostore-country-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    cursor: default;
}

.ostore-support-input-group .ostore-morocco-flag {
    flex-shrink: 0;
    border-radius: var(--radius-sm);
}

.ostore-support-input-group .ostore-code-text {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text-main);
}

.ostore-support-input-group .ostore-dropdown-caret {
    width: 14px;
    height: 14px;
    color: var(--color-text-light);
}

.ostore-support-input-group .ostore-phone-divider {
    width: 1px;
    height: 16px;
    background-color: var(--color-border);
    margin: 0 10px;
}

/* Textarea Specifics */
.ostore-support-input-group.ostore-textarea-container {
    height: auto;
    min-height: 100px;
    padding: 8px 12px;
    align-items: flex-start;
}

/* ── Input / Textarea ────────────────────────────── */
.ostore-support-input-group input,
.ostore-support-input-group textarea {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    font-family: inherit;
    font-size: 0.95rem !important;
    color: var(--color-text-main) !important;
    outline: none !important;
    box-shadow: none !important;
}

.ostore-support-input-group input {
    height: 100% !important;
}

.ostore-support-input-group textarea {
    height: auto !important;
    min-height: 80px;
    resize: vertical;
    line-height: 1.5;
}

.ostore-support-input-group input::placeholder,
.ostore-support-input-group textarea::placeholder {
    color: var(--color-text-light);
    opacity: 0.8;
    font-weight: 400;
}

/* ── Error / Status Message ──────────────────────── */
.ostore-support-message {
    font-size: 0.8rem;
    font-weight: 600;
    min-height: 0;
    line-height: 1.3;
    transition: all 0.2s;
}

/* ── Submit Button ───────────────────────────────── */
.ostore-support-submit-btn {
    background-color: var(--ostore-brand, var(--color-primary, var(--color-sale))) !important;
    color: #fff !important;
    border: 1px solid color-mix(in srgb, var(--ostore-brand, var(--color-primary, var(--color-sale))) 70%, transparent) !important;
    outline: none !important;
    box-shadow: var(--shadow-button) !important;
    border-radius: var(--theme-radius, 8px) !important;
    padding: 13px 20px;
    width: 100%;
    cursor: pointer;
    font-weight: 800;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: background-color var(--transition-fast), border-color var(--transition-fast) !important;
    position: relative;
    overflow: hidden;
    margin-top: 2px;
    font-family: inherit;
}

.ostore-support-submit-btn:hover {
    background-color: var(--color-primary-hover, #b30000) !important;
    border: 1px solid color-mix(in srgb, var(--color-primary-hover, #b30000) 70%, transparent) !important;
    outline: none !important;
    box-shadow: var(--shadow-button) !important;
}

.ostore-support-submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Loading spinner */
.ostore-support-submit-btn.loading {
    color: transparent;
    pointer-events: none;
}

.ostore-support-submit-btn.loading::after {
    content: "";
    position: absolute;
    width: 25px;
    height: 25px;
    top: calc(50% - 12.5px);
    left: calc(50% - 12.5px);
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-circle);
    border-top-color: #fff;
    animation: ostore-spin 0.6s linear infinite;
}

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

/* ── Trust Line ──────────────────────────────────── */
.ostore-support-trust {
    text-align: center;
    font-size: 0.72rem;
    color: #9ca3af;
    font-weight: 500;
    margin: 6px 0 0;
}

/* ── Success State ───────────────────────────────── */
.ostore-support-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 0 8px;
    text-align: center;
}

.ostore-support-success-icon {
    font-size: 3.5rem;
    line-height: 1;
    animation: ostore-popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes ostore-popIn {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.ostore-support-success h4 {
    font-size: 1.1rem;
    font-weight: 800;
    color: #111827;
    margin: 0;
}

.ostore-support-success p {
    font-size: 0.9rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* ── Mobile: Bottom Sheet overrides ──────────────── */
@media (max-width: 767px) {
    .ostore-support-input-group {
        height: 32px !important;
        padding: 0 8px !important;
        border-radius: var(--radius-md) !important;
    }
}

/* ── Desktop: Centered Modal ─────────────────────── */
@media (min-width: 768px) {
    #ostore-support-modal {
        align-items: center;
    }

    .ostore-support-panel {
        border-radius: var(--radius-lg);
        transform: translateY(20px) scale(0.97);
        max-height: 80vh;
    }

    .ostore-support-panel::before {
        display: none;
    }

    #ostore-support-modal.is-open .ostore-support-panel {
        transform: translateY(0) scale(1);
    }
}
