/* ============================================================================
   solar-designer.css — style cho công cụ thiết kế hệ ĐMT (/thiet-ke)
   Prefix: .sd-*  (engine solar-designer.js tự dựng DOM vào host)
   ============================================================================ */

/* ── Host + root ─────────────────────────────────────────────────────────── */
.sd-host { width: 100%; height: 100%; }
.sd-root {
    display: flex; flex-direction: column;
    width: 100%; height: 100%;
    background: #eef1f5;
    font-family: 'Lexend', 'Segoe UI', sans-serif;
    color: #111827;
    overflow: hidden;
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.sd-toolbar {
    display: flex; align-items: center; gap: .75rem;
    padding: .45rem .7rem;
    background: #fff; border-bottom: 1px solid #e2e8f0;
    flex: 0 0 auto; flex-wrap: wrap;
}
.sd-tabs { display: flex; border: 1px solid #d1d5db; border-radius: .55rem; overflow: hidden; }
.sd-tab {
    display: inline-flex; align-items: center; gap: .3rem;
    border: none; background: #fff; color: #374151;
    font: inherit; font-size: .82rem; font-weight: 600;
    padding: .45rem .8rem; cursor: pointer; min-height: 40px;
}
.sd-tab + .sd-tab { border-left: 1px solid #d1d5db; }
.sd-tab.on { background: var(--rz-primary, #6366f1); color: #fff; }
.sd-tab .material-icons { font-size: 1rem; }
.sd-tb-mid { flex: 1; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.sd-tb-right { display: flex; align-items: center; gap: .4rem; }

.sd-btn {
    display: inline-flex; align-items: center; gap: .3rem;
    border: none; border-radius: .5rem; padding: .45rem .75rem; min-height: 40px;
    background: var(--rz-primary, #6366f1); color: #fff;
    font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer;
}
.sd-btn:hover { filter: brightness(1.06); }
.sd-btn.alt { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.sd-btn.alt:hover { background: #f3f4f6; filter: none; }
.sd-btn:disabled { opacity: .5; cursor: not-allowed; }
.sd-btn .material-icons { font-size: 1rem; }

/* ── Main: stage + specs ─────────────────────────────────────────────────── */
.sd-main { flex: 1; display: flex; min-height: 0; }
.sd-stage { flex: 1; position: relative; min-width: 0; }
.sd-map-wrap, .sd-three-wrap { position: absolute; inset: 0; }
.sd-three-wrap canvas { display: block; }

/* Google Map container */
.sd-gmap { position: absolute; inset: 0; }

/* Ô tìm địa chỉ trên toolbar */
.sd-search { display: flex; align-items: center; gap: .35rem; flex: 1; max-width: 480px; }
.sd-search input {
    flex: 1; min-width: 160px; min-height: 40px;
    padding: .4rem .6rem;
    border: 1px solid #d1d5db; border-radius: .5rem;
    font-family: inherit; font-size: .82rem; outline: none;
    background: #fff; color: #111827;
}
.sd-search input:focus { border-color: var(--rz-primary, #6366f1); }

/* Map headless notice */
.sd-map-empty {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .5rem; text-align: center; padding: 1.5rem;
    background:
        linear-gradient(rgba(148,163,184,.14) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148,163,184,.14) 1px, transparent 1px);
    background-size: 40px 40px;
    color: #475569;
}
.sd-map-empty .material-icons { font-size: 2.6rem; opacity: .45; }
.sd-map-empty b { font-size: 1rem; color: #1f2937; }
.sd-map-empty p { font-size: .82rem; line-height: 1.55; max-width: 460px; margin: 0; }

/* ── Panel thông số (phải) ───────────────────────────────────────────────── */
.sd-specs {
    flex: 0 0 265px; display: flex; flex-direction: column;
    background: #fff; border-left: 1px solid #e2e8f0;
    padding: .7rem .8rem; overflow-y: auto;
}
.sd-specs-h {
    display: flex; align-items: center; gap: .4rem;
    font-size: .88rem; font-weight: 700; margin-bottom: .55rem;
}
.sd-specs-h .material-icons { color: var(--rz-primary, #6366f1); font-size: 1.15rem; }
.sd-spec-rows { display: flex; flex-direction: column; }
.sd-spec-row {
    display: flex; justify-content: space-between; align-items: center; gap: .5rem;
    padding: .42rem .1rem; border-bottom: 1px dashed #e5e7eb;
    font-size: .8rem; color: #4b5563;
}
.sd-spec-row b { color: #111827; font-size: .84rem; white-space: nowrap; }
.sd-specs-note { margin-top: .7rem; font-size: .7rem; color: #9ca3af; line-height: 1.5; }

/* ── Toolbar draw tools ──────────────────────────────────────────────────── */
.sd-drawtools { display: flex; align-items: center; gap: .35rem; }
.sd-btn.sm { min-height: 34px; padding: .3rem .55rem; font-size: .74rem; }
.sd-btn.on { background: var(--rz-primary, #6366f1); color: #fff; border-color: transparent; }
.sd-icobtn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border: none; border-radius: .45rem;
    background: none; color: #9ca3af; cursor: pointer;
}
.sd-icobtn:hover { background: #fee2e2; color: #dc2626; }
.sd-icobtn .material-icons { font-size: 1.05rem; }

/* ── Panel thuộc tính MÁI (trên cùng panel phải) ─────────────────────────── */
.sd-roof-panel { margin-bottom: .8rem; }
.sd-rp-hint {
    font-size: .78rem; color: #6b7280; line-height: 1.55;
    background: #f8fafc; border: 1px dashed #d7dde5; border-radius: .5rem;
    padding: .6rem .7rem; margin-bottom: .4rem;
}
.sd-rp-head { display: flex; align-items: center; gap: .4rem; margin-bottom: .15rem; }
.sd-rp-dot {
    width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto;
    background: var(--rc, #2563eb);
}
.sd-rp-name {
    flex: 1; min-width: 0; border: 1px solid transparent; border-radius: .35rem;
    font: inherit; font-size: .9rem; font-weight: 700; color: #111827;
    padding: .2rem .3rem; background: transparent;
}
.sd-rp-name:hover, .sd-rp-name:focus { border-color: #d1d5db; background: #fff; outline: none; }
.sd-rp-meta { font-size: .72rem; color: #6b7280; margin-bottom: .5rem; }
.sd-rp-sep {
    font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
    color: #6b7280; border-top: 1px solid #e5e7eb; margin-top: .6rem; padding-top: .55rem;
    margin-bottom: .25rem;
}
.sd-f { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .22rem 0; }
.sd-f label { font-size: .76rem; color: #4b5563; flex: 1 1 auto; }
.sd-f input[type="number"], .sd-f select {
    flex: 0 0 108px; width: 108px; min-height: 32px;
    border: 1px solid #d1d5db; border-radius: .4rem; padding: .25rem .4rem;
    font-family: inherit; font-size: .78rem; color: #111827; background: #fff; outline: none;
}
.sd-f input:focus, .sd-f select:focus { border-color: var(--rz-primary, #6366f1); }
.sd-inline { display: flex; align-items: center; gap: .3rem; flex: 0 0 auto; }
.sd-inline input[type="number"] { flex: 0 0 64px; width: 64px; }
.sd-rp-actions { display: flex; gap: .4rem; margin-top: .55rem; }
.sd-rp-actions .sd-btn { flex: 1; justify-content: center; }
.sd-rp-actions .sd-btn.alt { flex: 0 0 auto; }

/* ── Thanh mặt trời (overlay đáy tab 3D) ─────────────────────────────────── */
.sd-sunbar {
    position: absolute; left: .6rem; right: .6rem; bottom: .6rem; z-index: 20;
    display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
    padding: .45rem .7rem;
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(4px);
    border: 1px solid #e2e8f0; border-radius: .7rem;
    box-shadow: 0 4px 18px rgba(0,0,0,.12);
    font-size: .76rem; color: #374151;
}
.sd-sunbar label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; }
.sd-sunbar label b { min-width: 2.6em; color: var(--rz-primary, #6366f1); }
.sd-sunbar input[type="range"] { width: 130px; accent-color: var(--rz-primary, #6366f1); }
.sd-sun-info { color: #6b7280; }
.sd-sun-info b { color: #111827; }
.sd-shade-out { font-weight: 600; color: #111827; }
.sd-shade-legend i {
    display: inline-block; width: 10px; height: 10px; border-radius: 2px;
    margin: 0 .2rem 0 .5rem; vertical-align: -1px;
}

/* ── Dialog sd-* ─────────────────────────────────────────────────────────── */
.sd-dlg-ov {
    position: fixed; inset: 0; z-index: 100000;
    background: rgba(17, 24, 39, .55);
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.sd-dlg {
    background: #fff; border-radius: 12px; max-width: 440px; width: 100%;
    box-shadow: 0 16px 48px rgba(0,0,0,.35);
    font-family: 'Lexend', 'Segoe UI', sans-serif;
}
.sd-dlg-t { padding: 12px 16px; font-weight: 700; font-size: 15px; border-bottom: 1px solid #eee; }
.sd-dlg-m { padding: 14px 16px; font-size: 13.5px; line-height: 1.55; color: #374151; }
.sd-dlg-f { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid #eee; justify-content: flex-end; }
.sd-dlg-btn {
    border: none; border-radius: 8px; padding: 10px 16px; min-height: 42px;
    background: var(--rz-primary, #6366f1); color: #fff;
    font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.sd-dlg-btn.alt { background: #fff; color: #374151; border: 1.5px solid #d1d5db; }
.sd-dlg-in {
    display: block; width: 100%; margin-top: 10px; min-height: 44px;
    border: 1.5px solid #d1d5db; border-radius: 8px; padding: 8px 10px;
    font-family: inherit; font-size: 15px; font-weight: 700; color: #111827; outline: none;
}
.sd-dlg-in:focus { border-color: var(--rz-primary, #6366f1); }

/* ── Dialog xuất bản vẽ ──────────────────────────────────────────────────── */
.sd-exp-info { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .7rem; }
.sd-exp-info label { display: flex; align-items: center; gap: .5rem; font-size: 13px; color: #4b5563; }
.sd-exp-info input {
    flex: 1; min-height: 38px; border: 1.5px solid #d1d5db; border-radius: 8px;
    padding: 6px 10px; font-family: inherit; font-size: 13.5px; outline: none;
}
.sd-exp-info input:focus { border-color: var(--rz-primary, #6366f1); }
.sd-exp-views {
    display: grid; grid-template-columns: 1fr 1fr; gap: .25rem .8rem;
    border: 1px dashed #d7dde5; border-radius: 8px; padding: .55rem .7rem; margin-bottom: .6rem;
}
.sd-exp-row { display: flex; align-items: center; gap: .45rem; font-size: 13.5px; cursor: pointer;
              min-height: 34px; }
.sd-exp-row input { width: 17px; height: 17px; accent-color: var(--rz-primary, #6366f1); }
.sd-exp-paper { display: flex; align-items: center; gap: .5rem; font-size: 13.5px; }
.sd-exp-paper select {
    min-height: 38px; border: 1.5px solid #d1d5db; border-radius: 8px; padding: 4px 8px;
    font-family: inherit; font-size: 13.5px;
}

/* ── Review mode: ẩn panel phải + toolbar giữa cho sạch khung hình ───────── */
.sd-review .sd-specs { display: none; }
.sd-review .sd-tb-mid { visibility: hidden; }

/* ── Màn hình hẹp: cảnh báo nhẹ (không chặn) ─────────────────────────────── */
.sd-narrow-warn {
    display: flex; align-items: center; gap: .45rem;
    padding: .5rem .8rem; font-size: .8rem;
    background: #fffbeb; color: #92400e; border-bottom: 1px solid #fde68a;
}
.sd-narrow-warn .material-icons { font-size: 1rem; }
@media (max-width: 900px) {
    .sd-specs { flex-basis: 210px; }
}
