/* =============================================================
   DSM Frontend CSS v2.0
   ============================================================= */

/* ── Stock Finder Bar ──────────────────────────────────────── */
.dsm-sfbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #fff;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 14px;
    margin: 14px 0;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}

.dsm-sfbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.dsm-sfbar-ico {
    width: 20px;
    height: 20px;
    color: #16a34a;
    flex-shrink: 0;
}

.dsm-sfbar-lbl {
    font-weight: 700;
    font-size: .93em;
    color: #111827;
}

/* Inline badges */
.dsm-ibadge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: .78em;
    font-weight: 700;
}
.dsm-ok  { background: #dcfce7; color: #166534; }
.dsm-low { background: #fef9c3; color: #854d0e; }
.dsm-out { background: #fee2e2; color: #991b1b; }

/* Check button */
.dsm-sfbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    font-size: .88em;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
    flex-shrink: 0;
    letter-spacing: .3px;
}
.dsm-sfbar-btn:hover { background: #15803d; }

/* ── Modal ─────────────────────────────────────────────────── */
#dsm-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.dsm-mo-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(3px);
    z-index: 0;
}

.dsm-mo-box {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: visible;      /* allow dropdown to show outside */
    box-shadow: 0 24px 60px rgba(0,0,0,.25);
    animation: dsm-up .2s ease;
}

/* Clip header corners without hiding dropdown */
.dsm-mo-header { border-radius: 16px 16px 0 0; overflow: hidden; }

/* Body scrolls */
.dsm-mo-body  { overflow-y: auto; }

@keyframes dsm-up {
    from { transform: translateY(28px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Header */
.dsm-mo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #00acc1;
    padding: 15px 20px;
    flex-shrink: 0;
}

.dsm-mo-title {
    font-size: 1.05em;
    font-weight: 700;
    color: #fff;
    letter-spacing: .3px;
}

.dsm-mo-close {
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,.22);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: .95em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    line-height: 1;
}
.dsm-mo-close:hover { background: rgba(255,255,255,.42); }

/* Location tabs */
.dsm-mo-tabs {
    display: flex;
    gap: 10px;
    padding: 12px 16px 8px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.dsm-mo-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 10px;
    border-radius: 8px;
    border: 1.5px solid #d1d5db;
    background: #fff;
    font-size: .86em;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all .15s;
}
.dsm-mo-tab svg { width: 16px; height: 16px; flex-shrink: 0; }
.dsm-mo-tab:hover { border-color: #00acc1; color: #00acc1; }
.dsm-mo-tab-active { background: #00acc1 !important; border-color: #00acc1 !important; color: #fff !important; }

/* Manual search wrapper */
#dsm-manual-wrap {
    padding: 10px 16px 12px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
    z-index: 100;
}

/* Area search input box */
.dsm-area-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1.5px solid #d1d5db;
    border-radius: 25px;
    padding: 9px 14px;
    transition: border-color .15s;
}
.dsm-area-wrap:focus-within { border-color: #00acc1; }
.dsm-area-wrap svg { width: 16px; height: 16px; color: #9ca3af; flex-shrink: 0; }

#dsm-area-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: .93em;
    color: #111827;
    background: transparent;
}
#dsm-area-input::placeholder { color: #9ca3af; }

#dsm-area-dropdown {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-top: 6px;
    box-shadow: 0 8px 28px rgba(0,0,0,.18);
    max-height: 260px;
    overflow-y: auto;
    /* Overlays modal body */
    position: absolute;
    left: 16px;
    right: 16px;
    z-index: 9999;
}

#dsm-area-dropdown::-webkit-scrollbar { width: 5px; }
#dsm-area-dropdown::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 5px; }

/* Area list item */
.dsm-ai {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background .1s;
    user-select: none;
}
.dsm-ai:last-child { border-bottom: none; }
.dsm-ai:hover  { background: #ecfeff; }
.dsm-ai:active { background: #cffafe; }

.dsm-ai-pin  { font-size: 1em; flex-shrink: 0; color: #0e7490; }

.dsm-ai-info { flex: 1; min-width: 0; }
.dsm-ai-name { font-weight: 700; font-size: .88em; color: #111827; }
.dsm-ai-sub  { font-size: .78em; color: #6b7280; margin-top: 2px; }

/* Highlight matched text */
mark.dsm-hl {
    background: #fef08a;
    color: #111827;
    border-radius: 2px;
    padding: 0 1px;
    font-style: normal;
}

/* Empty / more hints */
.dsm-drop-empty,
.dsm-drop-more {
    padding: 14px 16px;
    color: #9ca3af;
    font-size: .85em;
    text-align: center;
}
.dsm-drop-more { border-top: 1px solid #f3f4f6; font-style: italic; }

/* Meta strip */
.dsm-mo-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 16px;
    background: #ecfeff;
    border-bottom: 1px solid #a5f3fc;
    font-size: .83em;
    color: #374151;
    flex-shrink: 0;
}

.dsm-color-chip {
    display: inline-block;
    background: #e0f7fa;
    color: #006064;
    border: 1px solid #b2ebf2;
    padding: 1px 10px;
    border-radius: 12px;
    font-weight: 700;
    font-size: .92em;
}

/* Modal body */
.dsm-mo-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px 16px;
}

.dsm-mo-body::-webkit-scrollbar { width: 5px; }
.dsm-mo-body::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 5px; }

/* Warning state */
.dsm-warn-box {
    text-align: center;
    padding: 28px 20px;
    background: #fffbeb;
    border: 1.5px solid #fbbf24;
    border-radius: 12px;
    margin-top: 6px;
}

.dsm-warn-ico {
    width: 52px;
    height: 52px;
    background: #fef3c7;
    border: 2px solid #fbbf24;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}
.dsm-warn-ico svg { width: 26px; height: 26px; color: #d97706; }
.dsm-warn-title { font-size: 1.05em; font-weight: 700; color: #92400e; margin-bottom: 6px; }
.dsm-warn-cta   { font-size: .93em; font-weight: 700; color: #16a34a; margin-bottom: 6px; }
.dsm-warn-sub   { font-size: .82em; color: #78716c; line-height: 1.5; }

/* Loading */
.dsm-load-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 48px 20px;
    color: #6b7280;
    font-size: .9em;
}

.dsm-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #00acc1;
    border-radius: 50%;
    animation: dsm-spin .7s linear infinite;
}

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

/* ── Showroom Cards ────────────────────────────────────────── */
.dsm-card-result {
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    position: relative;
    overflow: hidden;
}
.dsm-card-result:hover {
    border-color: #00acc1;
    box-shadow: 0 3px 12px rgba(0,172,193,.13);
}
.dsm-card-result:last-child { margin-bottom: 0; }

.dsm-recommended-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #16a34a;
    color: #fff;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: .76em;
    font-weight: 700;
}
.dsm-recommended-badge::before {
    content: '';
    width: 7px;
    height: 7px;
    background: #86efac;
    border-radius: 50%;
    display: inline-block;
}

.dsm-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 4px;
    font-size: .86em;
    line-height: 1.4;
}
.dsm-row-label { font-weight: 700; color: #111827; min-width: 72px; flex-shrink: 0; }
.dsm-row-colon { color: #9ca3af; flex-shrink: 0; }
.dsm-row-val   { color: #374151; }

/* Stock badges on cards */
.dsm-stk { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 12px; font-size: .82em; font-weight: 700; }
.dsm-stk-ok  { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.dsm-stk-low { background: #fef9c3; color: #b45309; border: 1px solid #fbbf24; }
.dsm-stk-out { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

.dsm-dist-tag { background: #f3f4f6; color: #6b7280; padding: 1px 8px; border-radius: 10px; font-size: .78em; }

.dsm-card-price { font-size: 1.05em; font-weight: 700; color: #dc2626; margin: 4px 0 2px; }

.dsm-delivery-note { font-size: .78em; color: #9ca3af; font-style: italic; margin: 5px 0 10px; }

.dsm-card-actions { display: flex; gap: 8px; }

.dsm-btn-show,
.dsm-btn-buy {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 10px;
    border-radius: 7px;
    font-size: .86em;
    font-weight: 700;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background .15s, transform .1s;
}
.dsm-btn-show { background: #16a34a; color: #fff; }
.dsm-btn-show:hover { background: #15803d; color: #fff; transform: translateY(-1px); }
.dsm-btn-buy  { background: #16a34a; color: #fff; }
.dsm-btn-buy:hover  { background: #15803d; color: #fff; transform: translateY(-1px); }
.dsm-btn-show svg,
.dsm-btn-buy  svg { width: 15px; height: 15px; }
.dsm-btn-disabled { background: #e5e7eb !important; color: #9ca3af !important; cursor: not-allowed !important; }

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 600px) {
    #dsm-modal { padding: 0; align-items: flex-end; }
    .dsm-mo-box { border-radius: 16px 16px 0 0; max-height: 92vh; }
    .dsm-mo-tab span { display: none; }
    .dsm-mo-tab { flex: none; width: 50%; justify-content: center; }
}
