/* Trang chi tiết style: đầu trang, Style Information, Style Files, tab, Sample Checklist. Mobile-first, dùng biến màu của style-studio.css */

.style-detail-page { width: min(100%, 1240px); margin: 0 auto; }
.button-small { min-height: 38px; padding: 0 12px; font-size: 13px; }

/* Thanh trên: breadcrumb ở giữa khi đủ chỗ */
@media (min-width: 768px) {
    .app-shell-focused .breadcrumb-trail { position: absolute; left: 50%; display: flex; transform: translateX(-50%); }
}

/* ---------- Đầu trang ---------- */
.style-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 22px; margin-bottom: 22px; }
.style-hero-media { position: relative; width: 150px; height: 128px; flex: 0 0 auto; overflow: hidden; border: 1px solid var(--studio-line); border-radius: 10px; background: #ece8df; }
.style-hero-photo,
.style-hero-artwork { width: 100%; height: 100%; object-fit: cover; }
.style-hero-artwork svg { width: 100%; height: 100%; }
.style-photo-change-button {
    position: absolute;
    right: 8px;
    bottom: 8px;
    left: 8px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid #e2e3dd;
    border-radius: 7px;
    background: rgba(255, 255, 255, .94);
    color: var(--studio-ink);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}
.style-photo-change-button:hover { background: #fff; }
.style-photo-change-button:focus-within { outline: 2px solid var(--studio-focus-ring); outline-offset: 2px; }
.style-photo-change-button.is-uploading { opacity: .7; pointer-events: none; }
.style-hero-text { min-width: 0; flex: 1 1 260px; }
.style-hero-text h1 { margin: 8px 0 4px; font-size: clamp(24px, 5vw, 32px); font-weight: 600; letter-spacing: -.6px; line-height: 1.2; overflow-wrap: anywhere; }
.style-hero-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; color: var(--studio-muted); font-size: 13px; }

/* ---------- Khung panel dùng chung ---------- */
.studio-panel { margin-bottom: 16px; padding: 16px; border: 1px solid var(--studio-line); border-radius: 12px; background: var(--studio-surface); }
.studio-panel-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 14px; }
.studio-panel-title { margin: 0; color: var(--studio-ink); font-size: 16px; font-weight: 700; }
.studio-panel-caption { color: var(--studio-green-dark); font-size: 12px; }
.studio-panel-actions { display: flex; gap: 8px; }
.studio-panel-note { margin: 12px 0 0; color: var(--studio-muted); font-size: 12px; }

/* ---------- Style Information ---------- */
.style-info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; margin: 0; }
.style-info-grid dt { margin-bottom: 4px; color: var(--studio-muted); font-size: 12px; font-weight: 400; }
.style-info-grid dd { margin: 0; color: var(--studio-ink); font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.style-info-grid dd.style-info-empty { color: var(--studio-soft-muted); font-weight: 400; }

/* ---------- Style Files ---------- */
.style-file-group-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.style-file-group-button {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--studio-line);
    border-radius: 8px;
    background: var(--studio-paper);
    color: var(--studio-ink);
    font-size: 14px;
    font-weight: 700;
    transition: background .15s, border-color .15s;
}
.style-file-group-button:hover { border-color: #d5d9cd; background: var(--studio-green-soft); }
.style-file-group-icon { flex: 0 0 auto; color: #d9a43b; fill: #f4cf6b; }
.style-file-group-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.style-file-group-count { color: var(--studio-soft-muted); font-size: 11px; font-weight: 600; }

/* Trình duyệt thư mục trong modal */
.document-browser-loading { display: grid; min-height: 120px; place-items: center; color: var(--studio-muted); }
.document-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; color: var(--studio-soft-muted); font-size: 14px; }
.document-breadcrumb strong { color: var(--studio-ink); }
.document-breadcrumb-link { padding: 4px 2px; border: 0; background: none; color: var(--studio-green-dark); font-weight: 600; }
.document-breadcrumb-link:hover { text-decoration: underline; }
.document-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.document-folder-form { display: flex; min-width: 0; flex: 1 1 260px; gap: 8px; }
.document-folder-form .studio-field { flex: 1 1 auto; }
.document-upload-button { flex: 0 0 auto; cursor: pointer; }
.document-upload-button:focus-within { outline: 2px solid var(--studio-focus-ring); outline-offset: 2px; }
.document-upload-button.is-uploading { opacity: .75; pointer-events: none; }
.document-empty { margin: 0; padding: 28px 12px; border: 1px dashed var(--studio-line); border-radius: 10px; color: var(--studio-muted); text-align: center; }
.document-entry-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--studio-line); border-radius: 10px; }
.document-entry { display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 4px; border-top: 1px solid var(--studio-line-soft); }
.document-entry:first-child { border-top: 0; }
.document-entry-main {
    min-width: 0;
    min-height: 44px;
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 10px;
    padding: 6px 8px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--studio-ink);
    text-align: left;
    text-decoration: none;
}
.document-entry-main:hover { background: var(--studio-surface-hover); color: var(--studio-ink); }
.document-entry-icon { flex: 0 0 auto; color: var(--studio-muted); }
.document-entry-icon-folder { color: #d9a43b; fill: #f4cf6b; }
.document-entry-name { min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; font-size: 14px; font-weight: 600; }
.document-entry-meta { width: 100%; padding-left: 28px; color: var(--studio-soft-muted); font-size: 12px; }

/* Nút biểu tượng dùng chung (xóa, tải về) */
.icon-action-button {
    width: 40px;
    height: 40px;
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid #e2e3dd;
    border-radius: 8px;
    background: #fff;
    color: #4f554d;
}
.icon-action-button:hover { background: #f6f6f3; color: var(--studio-ink); }
.icon-action-danger:hover { border-color: #f0dcd5; background: var(--studio-danger-soft); color: var(--studio-danger); }
.icon-action-button:disabled { opacity: .5; }

/* ---------- Tab ---------- */
.style-detail-tabs { margin: 26px 0 0; border-bottom: 1px solid var(--studio-line); overflow-x: auto; scrollbar-width: none; }
.style-detail-tabs .nav { flex-wrap: nowrap; gap: 4px; }
.style-detail-tab {
    position: relative;
    min-height: 46px;
    padding: 0 12px;
    border: 0;
    background: none;
    color: var(--studio-muted);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}
.style-detail-tab:hover { color: var(--studio-ink); }
.style-detail-tab.active { color: var(--studio-ink); }
.style-detail-tab.active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--studio-green-dark); content: ""; }
.style-detail-tab-content { padding-top: 22px; }

.studio-empty-panel { display: grid; justify-items: center; gap: 6px; padding: 44px 16px; border: 1px dashed var(--studio-line); border-radius: 12px; color: var(--studio-muted); text-align: center; }
.studio-empty-panel h2,
.studio-empty-panel h3 { margin: 4px 0 0; color: var(--studio-ink); font-size: 16px; font-weight: 700; }
.studio-empty-panel p { max-width: 420px; margin: 0; font-size: 14px; }

/* ---------- Sample Checklist ---------- */
#sampleChecklistPanelContainer.is-loading { opacity: .6; pointer-events: none; transition: opacity .15s; }
.sample-checklist { width: min(100%, 1100px); margin: 0 auto; }
.sample-checklist-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.sample-checklist-eyebrow { color: var(--studio-green-dark); font-size: 11px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; }
.sample-checklist-title { margin: 6px 0; font-size: clamp(20px, 4vw, 24px); font-weight: 500; letter-spacing: -.3px; }
.sample-checklist-subtitle { margin: 0; color: var(--studio-green-dark); font-size: 12px; }
.sample-checklist-exports { display: flex; flex-wrap: wrap; gap: 8px; }
.sample-checklist-exports .button { min-height: 42px; font-weight: 500; }

.sample-checklist-toolbar,
.overview-photos { margin-bottom: 16px; padding: 16px; border: 1px solid var(--studio-line); border-radius: 10px; background: #f7f7f4; }
.sample-checklist-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 12px; }
.sample-checklist-toolbar .studio-field select { background-color: #fff; }
.sample-checklist-toolbar-actions { display: flex; grid-column: 1 / -1; gap: 8px; }
.sample-checklist-toolbar-actions .button { flex: 1 1 auto; }

.overview-photos-title { margin: 0 0 4px; font-size: 16px; font-weight: 500; }
.overview-photos-subtitle { margin: 0 0 12px; color: var(--studio-muted); font-size: 12px; }
.overview-photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.overview-photo-slot { display: flex; min-width: 0; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--studio-line); border-radius: 10px; background: #fff; }
.overview-photo-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px; font-size: 13px; font-weight: 700; }
.overview-required-badge { padding: 1px 6px; border-radius: 999px; background: var(--studio-amber-soft); color: var(--studio-amber); font-size: 10px; font-weight: 600; }
.overview-photo-frame { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 8px; background: #f3f3f0; }
.overview-photo-frame a,
.overview-photo-frame img { width: 100%; height: 100%; display: block; object-fit: cover; }
.overview-photo-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--studio-soft-muted); font-size: 12px; }
.overview-photo-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.overview-photo-actions.is-uploading { opacity: .7; pointer-events: none; }
.overview-photo-pick { flex: 1 1 auto; justify-content: center; gap: 4px; min-height: 40px; padding-inline: 8px; cursor: pointer; font-size: 13px; font-weight: 500; }
.overview-photo-pick:focus-within { outline: 2px solid var(--studio-focus-ring); outline-offset: 2px; }
.overview-photo-warning { margin: 12px 0 0; color: var(--studio-amber); font-size: 12px; }

.photo-remove-button {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(38, 43, 40, .72);
    color: #fff;
}
.photo-remove-button:hover { background: var(--studio-danger); }

.checklist-manage-button { border-color: #d6e0cf; background: var(--studio-green-soft); color: var(--studio-green-darker); font-weight: 500; }
.checklist-manage-button:hover { background: #e3eadc; }
.checklist-summary { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 18px 0 12px; color: var(--studio-text); font-size: 13px; }
.checklist-summary strong { font-weight: 600; }
.checklist-summary-pass strong { color: #3f6a3a; }
.checklist-summary-fail strong { color: var(--studio-danger); }
.checklist-all-hidden { padding: 20px; border: 1px dashed var(--studio-line); border-radius: 10px; color: var(--studio-muted); text-align: center; }

.checklist-item-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--studio-line); border-radius: 10px; background: #fff; }
.checklist-item { border-top: 1px solid var(--studio-line); border-left: 3px solid transparent; }
.checklist-item:first-child { border-top: 0; border-top-left-radius: 9px; border-top-right-radius: 9px; }
.checklist-item:last-child { border-bottom-left-radius: 9px; border-bottom-right-radius: 9px; }
.checklist-item.checklist-status-pass { border-left-color: #8fae86; }
.checklist-item.checklist-status-fail { border-left-color: #c97a64; }
.checklist-item.checklist-status-na { border-left-color: #c9cbc4; }
.checklist-item-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; padding: 14px 12px; }
.checklist-item-titles { min-width: 0; flex: 1 1 260px; }
.checklist-item-titles strong { color: var(--studio-ink); font-size: 14px; font-weight: 700; }
.checklist-item-titles small { display: block; margin-top: 3px; color: var(--studio-green-dark); font-size: 12px; }
.checklist-custom-badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: #eef0f4; color: #5c6476; font-size: 10px; font-weight: 600; vertical-align: 2px; }
/* Mã kiểm tra, mức độ, giai đoạn, yêu cầu ảnh (theo checklist master Excel) */
.checklist-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-bottom: 4px; }
.checklist-check-code { color: var(--studio-muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; font-weight: 600; letter-spacing: .3px; }
.manage-item-label .checklist-check-code { display: block; }
.checklist-priority-badge,
.checklist-stage-badge,
.checklist-photo-required-badge { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 600; line-height: 16px; }
.checklist-priority-critical { background: #fbe6e3; color: var(--studio-danger); }
.checklist-priority-major { background: var(--studio-amber-soft); color: var(--studio-amber); }
.checklist-stage-badge { background: #eef0f4; color: #5c6476; }
.checklist-photo-required-badge { background: #edf2e9; color: #4f6a47; }
.checklist-photo-required-badge.is-missing { background: var(--studio-danger); color: #fff; }
/* Mục bắt buộc có ảnh: khung đỏ; chưa có ảnh thì khung đậm + nền hồng để nổi bật */
.checklist-item.is-photo-required { position: relative; box-shadow: inset 0 0 0 1px #e3a397; }
.checklist-item.is-photo-required.is-photo-missing { box-shadow: inset 0 0 0 2px var(--studio-danger); background: #fff6f4; }
.checklist-item.is-photo-required.is-photo-missing .checklist-photo-actions .button { border-color: var(--studio-danger); color: var(--studio-danger); }
.checklist-item-titles small.checklist-reference-standard { color: var(--studio-muted); font-style: italic; }
.checklist-critical-warning { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 10px 12px; border: 1px solid #f1c4bd; border-radius: 8px; background: #fdf1ef; color: var(--studio-danger); font-size: 13px; font-weight: 600; }
.checklist-critical-warning[hidden] { display: none; }
.checklist-group + .checklist-group { margin-top: 16px; }
.checklist-group-title { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: var(--studio-ink); font-size: 14px; font-weight: 700; }
.checklist-group-count { padding: 0 7px; border-radius: 999px; background: #eef0f4; color: #5c6476; font-size: 11px; font-weight: 600; }
.checklist-item-indicators { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.checklist-note-indicator,
.checklist-photo-indicator { display: inline-flex; align-items: center; gap: 4px; color: var(--studio-muted); font-size: 11px; }
.checklist-note-indicator[hidden],
.checklist-photo-indicator[hidden] { display: none; }
.checklist-item-controls { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.checklist-status-select {
    min-width: 140px;
    height: 44px;
    padding: 0 34px 0 14px;
    border: 1px solid #e0e1db;
    border-radius: 8px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%23262b28' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
    color: var(--studio-ink);
    font-size: 14px;
    appearance: none;
}
.checklist-status-select:focus { border-color: #9fb093; outline: 0; box-shadow: 0 0 0 3px rgba(155, 177, 141, .3); }
.checklist-status-pass .checklist-status-select { border-color: #b9cfb2; background-color: #f1f6ee; color: #3f6a3a; font-weight: 600; }
.checklist-status-fail .checklist-status-select { border-color: #e6c4b9; background-color: var(--studio-danger-soft); color: var(--studio-danger); font-weight: 600; }
.checklist-status-na .checklist-status-select { background-color: #f4f4f1; color: var(--studio-muted); }
.checklist-toggle-button { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid #e0e1db; border-radius: 8px; background: #fff; color: var(--studio-ink); }
.checklist-toggle-button:hover { background: #f6f6f3; }
.checklist-toggle-icon-minus,
.checklist-item.is-open .checklist-toggle-icon-plus { display: none; }
.checklist-item.is-open .checklist-toggle-icon-minus { display: block; }

.checklist-item-details { display: flex; flex-direction: column; gap: 12px; padding: 14px 12px 16px; border-top: 1px solid var(--studio-line); background: #f7f7f4; }
.checklist-item-details[hidden] { display: none; }
.checklist-item-details textarea,
.checklist-item-details input[type="text"] { width: 100%; padding: 10px 12px; border: 1px solid #e0e1db; border-radius: 8px; background: #fff; color: var(--studio-ink); font-size: 14px; }
.checklist-item-details input[type="text"] { height: 44px; padding: 0 12px; }
.checklist-item-details textarea { min-height: 72px; resize: vertical; }
.checklist-item-details textarea:focus,
.checklist-item-details input[type="text"]:focus { border-color: #9fb093; outline: 0; box-shadow: 0 0 0 3px rgba(155, 177, 141, .3); }
.checklist-item-details .is-invalid { border-color: var(--studio-danger) !important; }
.checklist-detail-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.checklist-photo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.checklist-photo-actions .button { cursor: pointer; font-weight: 500; }
.checklist-photo-actions .button:focus-within { outline: 2px solid var(--studio-focus-ring); outline-offset: 2px; }
.checklist-camera-button { border-color: #d6e0cf; background: var(--studio-green-soft); color: var(--studio-green-darker); }
.checklist-camera-button:hover { background: #e3eadc; }
.checklist-save-state { min-height: 18px; color: var(--studio-muted); font-size: 12px; }
.checklist-save-state.is-saved { color: #3f6a3a; }
.checklist-save-state.is-failed { color: var(--studio-danger); }
.checklist-photo-gallery { display: flex; flex-wrap: wrap; gap: 8px; }
.checklist-photo-gallery:empty { display: none; }
.checklist-photo { position: relative; width: 96px; height: 96px; margin: 0; overflow: hidden; border-radius: 8px; background: #e9e9e4; }
.checklist-photo img { width: 100%; height: 100%; display: block; object-fit: cover; }
.checklist-photo .photo-remove-button { top: 4px; right: 4px; width: 28px; height: 28px; }

/* Modal thêm / ẩn mục */
.manage-items-add-form { display: flex; gap: 8px; margin-bottom: 16px; }
.manage-items-add-form .studio-field { flex: 1 1 auto; }
/* Màn hình thấp: cả thân modal cuộn được (modal-dialog-scrollable cắt phần tràn nếu không có vùng cuộn) */
#checklistManageItemsBody { min-height: 0; overflow-y: auto; }
/* Danh sách 39+ mục: cuộn bên trong để ô thêm mục và tiêu đề modal luôn hiện */
.manage-item-list { max-height: 55vh; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; border: 1px solid var(--studio-line); border-radius: 10px; }
.manage-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-top: 1px solid var(--studio-line-soft); }
.manage-item:first-child { border-top: 0; }
.manage-item-label { display: flex; min-width: 0; min-height: 44px; flex: 1 1 auto; align-items: center; gap: 12px; margin: 0; cursor: pointer; }
.manage-item-label .form-check-input { width: 20px; height: 20px; flex: 0 0 auto; margin: 0; }
.manage-item-label .form-check-input:checked { border-color: var(--studio-green-dark); background-color: var(--studio-green-dark); }
.manage-item-label strong { font-size: 14px; font-weight: 600; }
.manage-item-label small { display: block; color: var(--studio-muted); font-size: 12px; }

/* ---------- Breakpoint ---------- */
@media (min-width: 576px) {
    .style-info-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .style-file-group-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .overview-photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .checklist-detail-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
    .studio-panel { padding: 18px 20px; }
    .overview-photo-frame { aspect-ratio: 2 / 1; }
    .sample-checklist-toolbar { display: flex; flex-wrap: wrap; }
    .sample-checklist-toolbar .studio-field { width: 190px; }
    .sample-checklist-toolbar-actions { grid-column: auto; }
    .sample-checklist-toolbar-actions .button { flex: 0 0 auto; }
    .checklist-item-head,
    .checklist-item-details { padding-right: 16px; padding-left: 16px; }
}

@media (min-width: 992px) {
    .style-info-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
    .style-file-group-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
