/* Instagram Story Generator - 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: #dd2a7b; }
.breadcrumb .separator { margin: 0 10px; color: #ddd; }
.breadcrumb .current { color: #333; font-weight: 600; }

.tool-header {
    background: linear-gradient(135deg, #f58529 0%, #dd2a7b 50%, #8134af 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; }
.igs-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: #dd2a7b; }

.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: #dd2a7b; }
.seg button.active { background: #fff; color: #dd2a7b; 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: #dd2a7b; 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, #f58529 0%, #be185d 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: #dd2a7b; color: #dd2a7b; }
.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: #dd2a7b; font-weight: 700; font-size: 13px; cursor: pointer; padding: 0; font-family: inherit; }
.link-btn:hover { text-decoration: underline; }

.igs-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; }
.igs-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: #fdf2f8; border-left: 4px solid #dd2a7b; 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; }
}

.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
.btn-danger { background: #fff; border: 2px solid #fecaca; color: #b91c1c; }
.btn-danger:hover:not(:disabled) { background: #fef2f2; }
.btn-block { width: 100%; margin-top: 12px; }
.mt { margin-top: 14px; }

.ig-layout { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 28px; align-items: start; }
.ig-preview-col { position: sticky; top: 16px; }
.ig-preview-card { background: #fff; border-radius: 20px; padding: 18px; box-shadow: 0 10px 30px rgba(0,0,0,0.08); }
.stage-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.bar-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mini-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: #374151; cursor: pointer; }
.mini-chk input { accent-color: #dd2a7b; }

.story-stage { position: relative; width: min(100%, 360px); aspect-ratio: 9 / 16; margin: 0 auto; border-radius: 22px; overflow: hidden; background: #111; box-shadow: 0 14px 40px rgba(0,0,0,0.25); }
.story-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#overlayCanvas { touch-action: none; }
.stage-hint { text-align: center; font-size: 11.5px; line-height: 1.5; color: #6b7280; margin: 10px 0 14px; }

.strip-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 8px; font-size: 14px; }
.story-strip-wrap { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.story-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px; flex: 1; }
.st-chip { position: relative; flex: 0 0 auto; padding: 0; border: 3px solid transparent; border-radius: 10px; overflow: hidden; background: #111; cursor: pointer; width: 54px; height: 96px; }
.st-chip canvas { width: 100%; height: 100%; display: block; }
.st-chip span { position: absolute; left: 3px; bottom: 3px; background: rgba(0,0,0,0.65); color: #fff; font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 6px; }
.st-chip.active { border-color: #dd2a7b; box-shadow: 0 0 0 2px rgba(221,42,123,0.25); }
.st-add { flex: 0 0 54px; height: 96px; border: 2px dashed #d1d5db; background: #fafafa; border-radius: 10px; font-size: 26px; color: #9ca3af; cursor: pointer; }
.st-add:hover { border-color: #dd2a7b; color: #dd2a7b; }

.export-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.export-scale { font-size: 13px; font-weight: 700; color: #374151; display: flex; align-items: center; gap: 8px; }
.export-scale select { padding: 7px 10px; border: 2px solid #e5e7eb; border-radius: 8px; font-weight: 700; font-size: 13px; }
.export-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.export-actions .btn-primary { flex: 1 1 auto; }

.ctl-group { background: #fff; border-radius: 16px; box-shadow: 0 6px 20px rgba(0,0,0,0.06); margin-bottom: 14px; overflow: hidden; }
.ctl-group summary { padding: 15px 18px; font-weight: 800; font-size: 15.5px; color: #1f2937; cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.ctl-group summary::-webkit-details-marker { display: none; }
.ctl-group summary::after { content: '▾'; color: #9ca3af; transition: transform .2s; }
.ctl-group[open] summary::after { transform: rotate(180deg); }
.ctl-body { padding: 4px 18px 18px; }

.add-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.add-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border: 2px solid #f1f5f9; background: #f9fafb; border-radius: 12px; font-weight: 700; font-size: 12px; color: #374151; cursor: pointer; font-family: inherit; transition: all .15s; }
.add-grid button span { font-size: 22px; }
.add-grid button:hover { border-color: #dd2a7b; background: #fdf2f8; color: #be185d; transform: translateY(-2px); }

.sel-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.ed-title { font-weight: 800; font-size: 14px; color: #be185d; margin-bottom: 10px; }
.frow { margin-bottom: 12px; }
.frow .lbl b { float: right; color: #dd2a7b; font-weight: 800; }
.frow input[type="range"] { width: 100%; accent-color: #dd2a7b; }
.clr { width: 56px; height: 38px; padding: 2px; border: 2px solid #e5e7eb; border-radius: 10px; background: #fff; cursor: pointer; }
textarea.txt { resize: vertical; min-height: 52px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: #374151; margin: 8px 0; cursor: pointer; }
.chk input { accent-color: #dd2a7b; width: 16px; height: 16px; }
.file-btn { cursor: pointer; }
.note { font-size: 11.5px; line-height: 1.5; margin-top: 8px; }

.el-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.el-chip { border: 2px solid #f1f5f9; background: #f9fafb; border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 700; color: #374151; cursor: pointer; font-family: inherit; }
.el-chip.active { border-color: #dd2a7b; background: #fdf2f8; color: #be185d; }

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.tpl { padding: 0; border: 2px solid #eef2f7; border-radius: 12px; overflow: hidden; background: #fff; cursor: pointer; display: flex; flex-direction: column; font-family: inherit; transition: all .15s; }
.tpl:hover { transform: translateY(-3px); border-color: #dd2a7b; box-shadow: 0 10px 20px rgba(0,0,0,0.12); }
.tpl canvas { width: 100%; aspect-ratio: 9 / 16; display: block; background: #111; }
.tpl span { font-size: 11px; font-weight: 800; color: #374151; padding: 6px 4px; text-align: center; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.18); cursor: pointer; transition: transform .15s; }
.swatch:hover { transform: scale(1.15); }
.color-trio { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }

@media (max-width: 960px) {
    .ig-layout { grid-template-columns: 1fr; }
    .ig-preview-col { position: static; }
}
