/* Collage Maker - unique "cm-" class prefix to avoid collisions with other media tools' CSS.
   Reuses the shared --site-dark/--site-dark-2/--site-light theme variables (defined once in
   content/assets/common.css) for the title bar and general layout, plus a tool-specific accent
   (--cm-accent) for this tool's own primary actions/active states, matching the "accent color"
   assigned to this tool in the Media Tools hub. */
.cm-card { padding: 28px; }
.cm-title-bar { background: linear-gradient(135deg, var(--site-dark) 0%, var(--site-dark-2) 100%); border-radius: 10px 10px 0 0; padding: 18px 24px; margin: -28px -28px 24px; }
.cm-title-bar h1 { color: #fff; margin: 0; font-size: 1.4em; text-align: center; }

.cm-intro { color: #4b5563; text-align: center; margin: 0 0 22px; font-size: .95em; }
.cm-intro strong { color: var(--site-dark); }

/* ===== Dropzone ===== */
.cm-dropzone { border: 2px dashed #cbd5e1; border-radius: 10px; padding: 36px 20px; text-align: center; color: #6b7280; cursor: pointer; transition: all .15s ease; }
.cm-dropzone:hover { border-color: var(--site-light); }
.cm-dropzone.dragover { border-color: var(--site-light); background: #f0fdfa; }
.cm-dropzone i { font-size: 2.3em; margin-bottom: 10px; display: block; color: #ea580c; }
.cm-dropzone p { margin: 0 0 4px; font-weight: 600; color: #374151; }
.cm-dropzone .cm-hint { font-size: .82em; color: #9ca3af; }
.cm-dropzone input[type="file"] { display: none; }

.cm-change-images-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 1px dashed #cbd5e1; background: #fff; color: #4b5563; border-radius: 10px; padding: 12px; font-weight: 600; font-size: .87em; cursor: pointer; transition: all .15s ease; }
.cm-change-images-btn:hover { border-color: var(--site-light); color: var(--site-dark); }

.cm-hint { font-size: .82em; color: #9ca3af; margin: 8px 0 0; }
.cm-error { color: var(--site-danger); background: var(--site-danger-bg); border: 1px solid var(--site-danger-border); border-radius: 8px; padding: 12px 16px; font-size: .9em; margin: 16px 0 0; }
.cm-error.hide { display: none; }

/* ===== Thumbnail strip ===== */
.cm-thumb-strip { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 0; }
.cm-thumb { position: relative; width: 78px; height: 78px; border-radius: 8px; overflow: hidden; border: 2px solid #e5e7eb; flex-shrink: 0; background: #f1f3f6; }
.cm-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cm-thumb-remove { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; border: none; cursor: pointer; font-size: .7em; display: flex; align-items: center; justify-content: center; line-height: 1; }
.cm-thumb-remove:hover { background: var(--site-danger); }
.cm-thumb-add { width: 78px; height: 78px; border-radius: 8px; border: 2px dashed #cbd5e1; display: flex; align-items: center; justify-content: center; color: #9ca3af; cursor: pointer; flex-shrink: 0; font-size: 1.4em; transition: all .15s ease; background: #fff; }
.cm-thumb-add:hover { border-color: var(--site-light); color: var(--site-dark); }
.cm-thumb-count { font-size: .82em; color: #6b7280; margin: 10px 0 0; }
.cm-thumb-count strong { color: #23272f; }

/* ===== Workspace ===== */
.cm-workspace { margin-top: 26px; }
.cm-section-label { font-size: .8em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; margin: 0 0 10px; }

/* ===== Layout picker + preview, side by side ===== */
.cm-layout-preview-row { display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: 24px; align-items: start; margin-bottom: 20px; }

.cm-layout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px; }
.cm-layout-card { border: 2px solid #e5e7eb; border-radius: 10px; padding: 10px 8px 8px; background: #fff; cursor: pointer; text-align: center; transition: all .15s ease; }
.cm-layout-card:hover { border-color: var(--site-light); }
.cm-layout-card.active { border-color: var(--site-light); background: #f0fdfa; }
.cm-layout-preview { position: relative; width: 100%; aspect-ratio: 1 / 1; background: #eef0f3; border-radius: 5px; overflow: hidden; margin-bottom: 8px; }
.cm-layout-preview-cell { position: absolute; background: #b7bec9; border: 1.5px solid #fff; box-sizing: border-box; border-radius: 2px; }
.cm-layout-card.active .cm-layout-preview-cell { background: var(--site-light); opacity: .8; }
.cm-layout-card span { font-size: .74em; font-weight: 600; color: #4b5563; display: block; line-height: 1.2; }
.cm-layout-card.active span { color: var(--site-dark); }

/* ===== Canvas preview ===== */
.cm-canvas-section { min-width: 0; }
.cm-canvas-wrap { position: relative; width: 100%; max-width: 440px; aspect-ratio: 1 / 1; margin: 0 auto; border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; background: repeating-conic-gradient(#f1f3f6 0% 25%, #fff 0% 50%) 50% / 20px 20px; }
.cm-canvas-wrap canvas { width: 100%; height: 100%; display: block; }
.cm-hotspot { position: absolute; cursor: pointer; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, 0); transition: background .15s ease; }
.cm-hotspot:hover { background: rgba(15, 23, 42, .38); }
.cm-hotspot-icon { color: #fff; opacity: 0; transform: scale(.85); transition: all .15s ease; text-align: center; font-size: .8em; font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.cm-hotspot:hover .cm-hotspot-icon { opacity: 1; transform: scale(1); }
.cm-hotspot-icon i { display: block; font-size: 1.6em; margin-bottom: 4px; }
.cm-canvas-hint { text-align: center; font-size: .82em; color: #9ca3af; margin-top: 10px; }

/* ===== Controls ===== */
.cm-controls { border: 1px solid #eee; border-radius: 10px; padding: 18px 20px; background: #fafbfc; margin-bottom: 20px; }
.cm-field { margin-bottom: 16px; }
.cm-field:last-child { margin-bottom: 0; }
.cm-field label { display: flex; justify-content: space-between; font-size: .85em; font-weight: 600; color: #374151; margin-bottom: 6px; }
.cm-field label span { color: var(--site-dark); font-weight: 700; }
.cm-field input[type="range"] { width: 100%; accent-color: var(--site-light); }
.cm-color-row { display: flex; align-items: center; gap: 12px; border: 1px solid #ddd; border-radius: 8px; padding: 8px 12px; background: #fff; }
.cm-color-row input[type="color"] { width: 40px; height: 40px; border: none; border-radius: 6px; padding: 0; cursor: pointer; background: none; flex-shrink: 0; }
.cm-color-row span { font-size: .85em; color: #6b7280; }
.cm-controls-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* ===== Buttons / status ===== */
.cm-btn { border: none; border-radius: 8px; padding: 13px 26px; font-weight: 700; cursor: pointer; font-size: .98em; display: flex; align-items: center; gap: 8px; background: var(--site-light); color: #fff; width: 100%; justify-content: center; transition: filter .15s ease; }
.cm-btn:disabled { opacity: .45; cursor: not-allowed; }
.cm-btn:not(:disabled):hover { filter: brightness(1.08); }
.cm-status { text-align: center; color: #6b7280; font-size: .88em; margin-top: 12px; min-height: 1.3em; }
.cm-status.cm-status-err { color: var(--site-danger); }
.cm-status:empty { display: none; }

@media (max-width: 780px) {
    .cm-layout-preview-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .cm-controls-row { grid-template-columns: 1fr; }
    .cm-layout-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
}
