/* Book Print Maker - Complete Styling */

.tool-page { padding-top: 0; }

.breadcrumb { padding: 20px 0; font-size: 14px; color: #666; }
.breadcrumb a { color: #666; transition: all 0.3s; }
.breadcrumb a:hover { color: #e11d48; }
.breadcrumb .separator { margin: 0 10px; color: #ddd; }
.breadcrumb .current { color: #333; font-weight: 600; }

.tool-header {
    background: linear-gradient(135deg, #1f2937 0%, #9f1239 50%, #e11d48 100%);
    color: white; padding: 60px 20px; text-align: center; position: relative; overflow: hidden;
}
.tool-header::before { content: '📚'; position: absolute; font-size: 300px; opacity: 0.07; top: -50px; right: -50px; animation: rotate 20s linear infinite; }
@keyframes rotate { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.tool-header-content { max-width: 800px; margin: 0 auto; position: relative; z-index: 1; }
.tool-icon-large { font-size: 72px; margin-bottom: 20px; animation: bounce 2s ease-in-out infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.tool-header h1 { font-size: 48px; font-weight: 900; margin-bottom: 15px; text-shadow: 2px 2px 4px rgba(0,0,0,0.2); }
.tool-subtitle { font-size: 20px; opacity: 0.95; margin-bottom: 25px; line-height: 1.6; }
.tool-meta { display: flex; justify-content: center; align-items: center; gap: 15px; flex-wrap: wrap; font-size: 16px; }
.meta-separator { opacity: 0.5; }

.tool-content { padding: 50px 20px 60px; background: #f8f9fa; }
.cb-root { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }

.card { background: #fff; border-radius: 20px; padding: 22px; box-shadow: 0 10px 30px rgba(0,0,0,0.08); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-head h3 { font-size: 19px; color: #1f2937; margin: 0; }
.card-head h3 small { font-size: 12px; color: #6b7280; font-weight: 600; margin-left: 8px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.muted { color: #6b7280; font-weight: 500; font-size: 12px; }
.lbl { display: block; font-size: 13px; font-weight: 700; color: #374151; margin-bottom: 8px; }
.txt { width: 100%; box-sizing: border-box; padding: 11px 12px; border: 2px solid #e5e7eb; border-radius: 10px; font-size: 14px; font-weight: 600; background: #fff; font-family: inherit; }
.txt:focus { outline: none; border-color: #e11d48; }

.seg { display: inline-flex; background: #f3f4f6; border-radius: 10px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { flex: 1 1 auto; border: none; background: transparent; padding: 8px 14px; border-radius: 8px; font-weight: 700; font-size: 13px; color: #4b5563; cursor: pointer; transition: all .2s; white-space: nowrap; }
.seg button:hover { color: #e11d48; }
.seg button.active { background: #fff; color: #e11d48; box-shadow: 0 2px 8px rgba(0,0,0,0.12); }

.code-tabs { display: flex; gap: 4px; flex-wrap: wrap; background: #f3f4f6; padding: 3px; border-radius: 10px; }
.code-tabs button { border: none; background: transparent; padding: 8px 14px; border-radius: 8px; font-weight: 700; font-size: 13px; color: #4b5563; cursor: pointer; }
.code-tabs button.active { background: #fff; color: #e11d48; box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.code-box { width: 100%; box-sizing: border-box; background: #0f172a; color: #e2e8f0; border: none; border-radius: 12px; padding: 16px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.6; resize: vertical; white-space: pre; overflow: auto; }
.code-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

.btn { padding: 12px 24px; border-radius: 10px; border: none; cursor: pointer; font-weight: 700; font-size: 14px; transition: all 0.3s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); font-family: inherit; }
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #1f2937 0%, #9f1239 100%); color: white; }
.btn-ghost { background: white; border: 2px solid rgba(0,0,0,0.1); color: #1f2937; }
.btn-ghost:hover:not(:disabled) { border-color: #e11d48; color: #e11d48; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-xs { padding: 6px 10px; font-size: 12px; border-radius: 8px; box-shadow: none; }
.link-btn { border: none; background: none; color: #e11d48; font-weight: 700; font-size: 13px; cursor: pointer; padding: 0; font-family: inherit; }
.link-btn:hover { text-decoration: underline; }

.cb-toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 30px); background: #111827; color: #fff; padding: 12px 22px; border-radius: 12px; font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; transition: all .3s; z-index: 9999; max-width: 90vw; text-align: center; }
.cb-toast.show { opacity: 1; transform: translate(-50%, 0); }

.info-box { background: white; border-radius: 20px; padding: 30px; box-shadow: 0 10px 30px rgba(0,0,0,0.08); }
.info-box h4 { font-size: 20px; margin-bottom: 20px; color: #1f2937; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.info-item { background: #fff1f2; border-left: 4px solid #e11d48; padding: 16px; border-radius: 10px; font-size: 14px; line-height: 1.6; color: #374151; }
.seo-content { padding: 50px 20px; background: #fff; }
.content-article { max-width: 900px; margin: 0 auto; }
.content-article h2 { font-size: 28px; margin: 32px 0 14px; color: #1f2937; }
.content-article p { font-size: 16px; line-height: 1.8; color: #4b5563; margin-bottom: 14px; }
.content-article code { background: #f1f5f9; padding: 2px 6px; border-radius: 6px; font-size: 14px; }

@media (max-width: 600px) {
    .tool-header { padding: 40px 16px; }
    .tool-header h1 { font-size: 32px; }
    .tool-subtitle { font-size: 16px; }
    .tool-icon-large { font-size: 56px; }
    .tool-content { padding: 30px 12px 40px; }
    .content-article h2 { font-size: 22px; }
}

.cb-load-err { display: none; background: #fef2f2; border: 2px solid #fecaca; color: #991b1b; padding: 14px 18px; border-radius: 14px; font-weight: 700; }
.cb-root .muted-p { font-size: 14px; color: #4b5563; line-height: 1.6; margin: 0 0 12px; }
.mt { margin-top: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.danger { color: #b91c1c !important; }

.seg-mini { display: inline-flex; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; }
.seg-mini button { background: #fff; color: #4b5563; border: none; padding: 6px 12px; font-weight: 800; font-size: 12.5px; cursor: pointer; font-family: inherit; }
.seg-mini button.active { background: #e11d48; color: #fff; }

.dz { border: 3px dashed #fda4af; background: #fff1f2; border-radius: 18px; padding: 34px 18px; text-align: center; cursor: pointer; transition: all .2s; }
.dz:hover, .dz.over, .dz:focus-visible { background: #ffe4e6; border-color: #e11d48; outline: none; }
.dz-ico { font-size: 42px; }
.dz-t { font-size: 18px; font-weight: 800; color: #9f1239; margin-top: 6px; }
.dz-s { font-size: 13px; color: #6b7280; margin-top: 4px; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.fchip { background: #f3f4f6; border-radius: 999px; padding: 6px 8px 6px 12px; font-size: 13px; font-weight: 700; color: #374151; display: inline-flex; align-items: center; gap: 6px; }
.fchip small { color: #6b7280; font-weight: 600; }
.fx { border: none; background: #e5e7eb; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; font-size: 11px; line-height: 1; color: #4b5563; }
.fx:hover { background: #fecaca; color: #991b1b; }

.empty { text-align: center; color: #9ca3af; font-weight: 700; padding: 26px 10px; }
.page-grid { display: flex; flex-direction: column; gap: 18px; }
.comic { border: 2px solid #f3f4f6; border-radius: 16px; padding: 12px; background: #fcfcfd; }
.comic-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 14px; color: #1f2937; }
.chip { display: inline-block; background: #f3f4f6; color: #4b5563; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.chip.ok { background: #dcfce7; color: #166534; }
.chip.warn { background: #ffedd5; color: #9a3412; }
.th-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 8px; }
.th { position: relative; aspect-ratio: 3 / 4; background: #fff; border: 2px solid #e5e7eb; border-radius: 8px; cursor: pointer; user-select: none; -webkit-user-select: none; overflow: hidden; }
.th:hover { border-color: #fda4af; }
.th.sel { border-color: #e11d48; box-shadow: 0 0 0 2px #fecdd3; }
.th.cov { border-color: #16a34a; }
.th.drag { opacity: .45; }
.th.over { border-color: #e11d48; border-style: dashed; background: #fff1f2; }
.th-img { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #f9fafb; }
.th-img canvas { max-width: 100%; max-height: 100%; display: block; }
.th.blank .th-img { background: repeating-linear-gradient(45deg, #fff, #fff 6px, #f3f4f6 6px, #f3f4f6 12px); font-size: 11px; font-weight: 800; color: #9ca3af; }
.th-n { position: absolute; left: 3px; bottom: 3px; background: rgba(17,24,39,.78); color: #fff; font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 999px; }
.th-n.c { background: #16a34a; }
.th-m { position: absolute; right: 2px; top: 2px; width: 22px; height: 22px; border: none; border-radius: 50%; background: rgba(255,255,255,.9); color: #374151; font-weight: 900; cursor: pointer; line-height: 1; box-shadow: 0 1px 4px rgba(0,0,0,.2); padding: 0; }
.th-m:hover { background: #e11d48; color: #fff; }

.cb-ctx { display: none; position: fixed; z-index: 9999; min-width: 230px; background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.25); padding: 6px; }
.cb-ctx button { display: block; width: 100%; text-align: left; border: none; background: transparent; padding: 9px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 700; color: #1f2937; cursor: pointer; font-family: inherit; }
.cb-ctx button:hover { background: #fff1f2; color: #9f1239; }
.cb-ctx button.danger:hover { background: #fef2f2; }
.cb-ctx hr { border: none; border-top: 1px solid #f3f4f6; margin: 4px 0; }

.seg.big { display: flex; }
.seg.big button { padding: 12px 14px; font-size: 14px; }
.seg button.active { color: #e11d48; }
.mode-desc { margin: 12px 0 4px; padding: 12px 14px; background: #fff1f2; border-left: 4px solid #e11d48; border-radius: 10px; font-size: 14px; line-height: 1.6; color: #374151; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 22px; margin-top: 18px; }
.set-block { display: flex; flex-direction: column; }
.set-block .seg { align-self: flex-start; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: #374151; margin-top: 12px; cursor: pointer; }
.chk input { accent-color: #e11d48; width: 16px; height: 16px; }
.paper-guide { margin-top: 20px; }
.pg-t { font-size: 14px; margin-bottom: 8px; }
.pg-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pgc { border: 2px solid #f1f5f9; background: #f9fafb; color: #374151; border-radius: 12px; padding: 8px 12px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; }
.pgc b { color: #e11d48; margin-left: 4px; }
.pgc.low b { color: #b45309; }
.pgc:hover { border-color: #e11d48; background: #fff1f2; }
.pgc.active { background: #e11d48; border-color: #e11d48; color: #fff; }
.pgc.active b { color: #fff; }

.out-card { border: 2px solid #f3f4f6; border-radius: 16px; padding: 16px; margin-bottom: 16px; }
.out-head { font-size: 17px; color: #1f2937; margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.warn-box { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.out-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.manual { margin-top: 12px; font-size: 13px; }
.manual summary { cursor: pointer; font-weight: 800; color: #6b7280; margin-bottom: 8px; }
.guide { margin-top: 14px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px 16px; font-size: 13.5px; color: #374151; }
.guide ul { margin: 8px 0 0; padding-left: 20px; line-height: 1.7; }
.guide li b { color: #be123c; }
.prev { margin-top: 14px; }
.sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 12px; }
.sh { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px; }
.sh-t { font-size: 12.5px; font-weight: 800; color: #6b7280; margin-bottom: 8px; }
.faces { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.faces canvas { display: block; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.12); background: #fff; }
.fc { text-align: center; font-size: 11px; color: #6b7280; margin-top: 2px; }
.fc b { color: #111827; }
.rtl-note { font-size: 12.5px; background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.rtl-note.warn { background: #fef2f2; border-color: #fecaca; color: #b91c1c; font-weight: 700; }
.fl { text-align: center; font-size: 11.5px; font-weight: 800; color: #9ca3af; margin-top: 4px; }

.cb-modal { display: none; position: fixed; inset: 0; z-index: 9998; background: rgba(15,23,42,.55); align-items: center; justify-content: center; padding: 16px; }
.cb-modal.show { display: flex; }
.cb-modal-in { background: #fff; border-radius: 18px; padding: 22px; width: min(440px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.cb-modal-in h3 { margin: 0 0 8px; font-size: 20px; color: #1f2937; }
.cb-modal-in p { font-size: 14px; color: #4b5563; line-height: 1.6; margin: 0 0 12px; }
.cb-modal-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

@media (max-width: 960px) { .th-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 560px) { .th-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .two { grid-template-columns: 1fr; } .seg.big { flex-direction: column; } }
