/* ============================================================
   Dokan Region Manager — Frontend Styles
   ============================================================ */

/* ── Buyer Region Picker ──────────────────────────────────── */

.drm-buyer-picker {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    z-index: 9999 !important;
}

.drm-picker-trigger {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
    padding: 7px 10px 7px 8px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: inherit !important;
    line-height: 1.4 !important;
    white-space: nowrap !important;
    transition: opacity .18s ease !important;
    box-shadow: none !important;
    outline: none !important;
}

.drm-picker-trigger:hover,
.drm-picker-trigger:focus {
    opacity: .8 !important;
    box-shadow: none !important;
    border: none !important;
}

.drm-picker-trigger[aria-expanded="true"] {
    opacity: .85 !important;
    box-shadow: none !important;
}

.drm-picker-flag {
    font-size: 17px !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

.drm-picker-label {
    font-weight: 600 !important;
    color: #111827 !important;
    letter-spacing: -.01em !important;
}

.drm-picker-label small.drm-picker-currency {
    font-weight: 400 !important;
    font-size: 13px !important;
    color: #6b7280 !important;
    margin-left: 3px !important;
}

.drm-picker-caret {
    font-size: 10px !important;
    color: #9ca3af !important;
    margin-left: 1px !important;
    flex-shrink: 0 !important;
    transition: transform .18s ease !important;
}

.drm-picker-trigger[aria-expanded="true"] .drm-picker-caret {
    transform: rotate(180deg) !important;
}

/* Dropdown */
.drm-picker-dropdown {
    position: absolute !important;
    top: calc(100% + 5px) !important;
    left: 0 !important;
    min-width: 210px !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.13), 0 2px 6px rgba(0,0,0,.07) !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 5px 0 !important;
    z-index: 10000 !important;
    overflow: hidden !important;
}

.drm-picker-dropdown[hidden] {
    display: none !important;
}

.drm-picker-option {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px 16px !important;
    cursor: pointer !important;
    transition: background .12s ease !important;
    border: none !important;
    background: transparent !important;
}

.drm-picker-option:hover {
    background: #f5f7ff !important;
}

.drm-picker-option.drm-active {
    background: #eef2ff !important;
}

.drm-opt-flag {
    font-size: 19px !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
    width: 24px !important;
    text-align: center !important;
}

.drm-opt-name {
    flex: 1 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #1f2937 !important;
}

.drm-picker-option.drm-active .drm-opt-name {
    font-weight: 700 !important;
    color: #4f46e5 !important;
}

.drm-opt-currency {
    font-size: 12px !important;
    color: #9ca3af !important;
    font-weight: 600 !important;
    letter-spacing: .02em !important;
    flex-shrink: 0 !important;
}

/* ── Seller Panel ─────────────────────────────────────────── */

.drm-seller-panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 24px;
    max-width: 680px;
    font-family: inherit;
}

.drm-panel-header h3 {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 700;
}

.drm-panel-hint {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 20px;
}

.drm-region-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.drm-region-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 12px;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: background .2s, transform .1s;
    text-align: center;
    position: relative;
    background: #f4f6f4;
}

.drm-region-card:hover {
    background: #e8ede8;
    transform: translateY(-1px);
}

.drm-region-card--selected,
.drm-region-card:has(input:checked) {
    border-color: #2c3e30;
    background: #e4ece5;
}

.drm-region-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.drm-card-flag {
    font-size: 28px;
    line-height: 1;
}

.drm-card-name {
    font-weight: 600;
    font-size: 14px;
    color: #111827;
}

.drm-card-currency {
    font-size: 12px;
    color: #2c3e30;
    font-weight: 600;
}

.drm-form-footer {
    border-top: 1px solid #f3f4f6;
    padding-top: 16px;
}

.drm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .2s, transform .1s;
}

.drm-btn-primary {
    background: #2c3e30;
    color: #fff;
}

.drm-btn-primary:hover {
    background: #1e2b21;
    transform: translateY(-1px);
}

.drm-form-note {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 10px;
}

.drm-alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.drm-alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

/* ── Restriction Notice ───────────────────────────────────── */

.drm-restriction-notice {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-left: 4px solid #f97316;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.drm-restriction-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.drm-restriction-body {
    flex: 1;
}

.drm-restriction-title {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #9a3412;
    margin-bottom: 4px;
}

.drm-restriction-current {
    font-size: 13px;
    color: #78350f;
    margin: 0 0 12px;
}

.drm-switch-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.drm-switch-btn {
    padding: 6px 14px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background .2s;
}

.drm-switch-btn:hover {
    background: #4f46e5;
}

.drm-keep-region {
    font-size: 13px;
    color: #9ca3af;
    text-decoration: none;
    margin-left: 4px;
}

.drm-keep-region:hover {
    color: #6b7280;
}

/* ── Out-of-region badge in shop loop ────────────────────── */

.drm-out-of-region-badge {
    display: inline-block;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid #e5e7eb;
    margin-top: 4px;
}

/* ── Converted price ─────────────────────────────────────── */

.drm-converted-price {
    display: inline-block;
}

.drm-currency-code {
    font-size: 11px;
    color: #6b7280;
    font-weight: normal;
    margin-left: 2px;
}

/* ── First-visit popup ───────────────────────────────────── */

.drm-popup-overlay {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0,0,0,.6) !important;
    z-index: 2147483647 !important;
    /* display is intentionally NOT !important — jQuery fadeIn/fadeOut controls it */
    display: flex;
    align-items: center;
    justify-content: center;
    animation: drmFadeIn .25s ease;
}

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

.drm-popup-box {
    background: #fff;
    border-radius: 14px;
    padding: 32px;
    max-width: 480px;
    width: 92%;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    animation: drmSlideUp .3s ease;
}

@keyframes drmSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.drm-popup-header h3 {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 8px;
    color: #111827;
}

.drm-popup-header p {
    color: #6b7280;
    font-size: 14px;
    margin: 0 0 24px;
}

.drm-popup-regions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.drm-popup-region-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 10px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}

.drm-popup-region-btn:hover {
    border-color: #6366f1;
    background: #eef2ff;
}

.drm-popup-flag {
    font-size: 26px;
}

.drm-popup-name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.drm-popup-currency {
    font-size: 11px;
    color: #6366f1;
    font-weight: 700;
}


/* ── Mobile optimizations ───────────────────────────────── */

@media (max-width: 600px) {

    /* Buyer picker */
    .drm-picker-dropdown {
        left: auto !important;
        right: 0 !important;
        min-width: 180px !important;
    }

    /* Seller panel */
    .drm-seller-panel {
        padding: 16px !important;
    }
    .drm-region-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
    .drm-btn {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Popup */
    .drm-popup-box {
        padding: 22px 16px !important;
        width: 96% !important;
        border-radius: 10px !important;
    }
    .drm-popup-header h3 {
        font-size: 18px !important;
    }
    .drm-popup-regions {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }
    .drm-popup-region-btn {
        padding: 12px 8px !important;
    }

    /* Restriction notice */
    .drm-restriction-notice {
        flex-direction: column !important;
        gap: 8px !important;
    }
}

/* ── Login notice ────────────────────────────────────────── */

.drm-login-notice {
    background: #f3f4f6;
    padding: 14px 18px;
    border-radius: 6px;
    color: #374151;
    font-size: 14px;
}
