/* CSS Clip-Path 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: #059669; }
.breadcrumb .separator { margin: 0 10px; color: #ddd; }
.breadcrumb .current { color: #333; font-weight: 600; }

.tool-header {
    background: linear-gradient(135deg, #10b981 0%, #0d9488 50%, #0ea5e9 100%);
    color: white;
    padding: 60px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.tool-header::before { content: '✂️'; position: absolute; font-size: 300px; opacity: 0.06; 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; }
.clip-root { max-width: 1240px; margin: 0 auto; }

/* Layout */
.clip-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 26px; align-items: start; }
.clip-editor-col { position: sticky; top: 16px; }
.editor-card, .panel { background: #fff; border-radius: 20px; padding: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.08); }
.clip-controls-col { display: flex; flex-direction: column; gap: 20px; }
.panel.wide { margin-top: 26px; }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h3 { font-size: 18px; color: #1f2937; margin: 0; }
.panel-head h3 small { font-size: 12px; color: #6b7280; font-weight: 600; margin-left: 8px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tb-actions { display: flex; gap: 8px; }

/* Stage */
.editor-wrap {
    padding: 34px;
    background:
        linear-gradient(45deg, #eef0f3 25%, transparent 25%) 0 0 / 20px 20px,
        linear-gradient(-45deg, #eef0f3 25%, transparent 25%) 0 10px / 20px 20px,
        linear-gradient(45deg, transparent 75%, #eef0f3 75%) 10px -10px / 20px 20px,
        linear-gradient(-45deg, transparent 75%, #eef0f3 75%) -10px 0 / 20px 20px,
        #fafbfc;
    border-radius: 14px;
    overflow: hidden;
}
.stage { position: relative; width: 100%; margin: 0 auto; aspect-ratio: 1 / 1; touch-action: none; user-select: none; }
.stage.show-grid::after {
    content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
    background-image:
        linear-gradient(to right, rgba(0,0,0,0.12) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0,0,0,0.12) 1px, transparent 1px);
    background-size: 10% 10%;
    outline: 1px solid rgba(0,0,0,0.25);
}
.ghost { position: absolute; inset: 0; opacity: 0.22; }
.clip-target { position: absolute; inset: 0; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 2; }
#overlay .seg { pointer-events: stroke; cursor: copy; }
.handles { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.handle {
    position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px;
    background: #fff; border: 3px solid #10b981; border-radius: 50%;
    pointer-events: auto; cursor: grab; display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 800; color: #047857; box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: transform .1s, background .1s;
}
.handle:hover { transform: scale(1.2); }
.handle:active { cursor: grabbing; }
.handle.selected { background: #10b981; color: #fff; border-color: #064e3b; transform: scale(1.2); }

.hint-line { font-size: 12.5px; color: #6b7280; line-height: 1.6; margin: 12px 2px; }
.opt-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.mini { font-size: 13px; font-weight: 700; color: #374151; display: inline-flex; align-items: center; gap: 8px; }
.mini select { padding: 6px 8px; border: 2px solid #e5e7eb; border-radius: 8px; font-weight: 700; background: #fff; }

.row { margin-bottom: 14px; }
.row > label { display: block; font-size: 13px; font-weight: 700; color: #374151; margin-bottom: 6px; }
.row > label b { float: right; color: #059669; font-weight: 800; }
.row input[type="range"] { width: 100%; accent-color: #059669; }
.bg-block { margin-top: 10px; }
.bg-block input[type="color"] { width: 54px; height: 38px; padding: 2px; border: 2px solid #e5e7eb; border-radius: 8px; background: #fff; cursor: pointer; }
.muted { color: #6b7280; font-weight: 500; font-size: 12px; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #374151; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: #059669; cursor: pointer; }

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

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 42px; height: 42px; border-radius: 12px; border: 3px solid transparent; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.15); transition: transform .15s; }
.swatch:hover { transform: scale(1.08); }
.swatch.active { border-color: #111827; }

/* Code */
.code-tabs { display: flex; gap: 4px; flex-wrap: wrap; background: #f3f4f6; padding: 3px; border-radius: 10px; }
.code-tabs button { border: none; background: transparent; padding: 7px 12px; border-radius: 8px; font-weight: 700; font-size: 13px; color: #4b5563; cursor: pointer; }
.code-tabs button.active { background: #fff; color: #059669; 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: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.6; resize: vertical; white-space: pre-wrap; word-break: break-all; }
.code-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.foot-opts { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.png-row { display: flex; gap: 10px; margin-top: 12px; align-items: center; }
.png-row select { padding: 8px 10px; border: 2px solid #e5e7eb; border-radius: 10px; font-weight: 700; background: #fff; }

/* Points */
.tf-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.point-table { max-height: 300px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.pt-row { display: grid; grid-template-columns: 26px 1fr 1fr 30px; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 10px; border: 2px solid transparent; cursor: pointer; }
.pt-row:hover { background: #f8fafc; }
.pt-row.sel { border-color: #10b981; background: #ecfdf5; }
.pt-n { width: 24px; height: 24px; border-radius: 50%; background: #10b981; color: #fff; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.pt-row label { font-size: 12px; font-weight: 800; color: #6b7280; display: flex; align-items: center; gap: 6px; }
.pt-row input { width: 100%; min-width: 0; padding: 6px 8px; border: 2px solid #e5e7eb; border-radius: 8px; font-size: 13px; font-weight: 700; box-sizing: border-box; }
.pt-row input:focus { outline: none; border-color: #10b981; }
.pt-del { border: none; background: #fee2e2; color: #b91c1c; border-radius: 8px; width: 28px; height: 28px; cursor: pointer; font-weight: 800; }

.import-box { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 2px solid #e5e7eb; border-radius: 10px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; margin-bottom: 10px; resize: vertical; }
.import-box:focus { outline: none; border-color: #10b981; }

/* Presets */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.preset { background: #f8fafc; border: 2px solid #eef2f7; border-radius: 14px; padding: 12px 8px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; transition: all .2s; }
.preset:hover { border-color: #10b981; transform: translateY(-3px); box-shadow: 0 10px 22px rgba(16,185,129,0.22); }
.preset .pv { width: 64px; height: 64px; background: linear-gradient(135deg, #10b981, #0ea5e9); display: block; }
.preset small { font-size: 11px; font-weight: 700; color: #4b5563; text-align: center; }

/* Buttons */
.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); }
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, #10b981 0%, #047857 100%); color: white; }
.btn-success { background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 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: #059669; color: #059669; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

.clip-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; }
.clip-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Info + SEO */
.info-box { background: white; border-radius: 20px; padding: 30px; margin-top: 36px; 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: #ecfdf5; border-left: 4px solid #10b981; 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: 960px) {
    .clip-layout { grid-template-columns: 1fr; }
    .clip-editor-col { position: static; }
}
@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; }
    .editor-wrap { padding: 26px; }
    .preset-grid { grid-template-columns: repeat(3, 1fr); }
    .content-article h2 { font-size: 22px; }
}
