/* ==========================================================================
   Color Picker page — styles
   Loaded only by /color-picker/index.html alongside style.css.
   Self-contained per tool-board independence rule; .cp- prefix.
   ========================================================================== */

.cp-page-title {
    font-size: 36px; font-weight: 700; color: #333;
    text-align: center; margin: 1.5rem 0 0.5rem;
}
.cp-page-subtitle {
    font-size: 18px; color: #6b7280;
    text-align: center; margin: 0 auto 1.5rem; line-height: 1.5;
}

/* ── Upload dropzone ──────────────────────────────────────────────────── */
.cp-dropzone {
    width: 625px; height: 260px;
    transform: scale(1.6);
    margin: 8rem auto 10rem !important;
    cursor: pointer; box-sizing: border-box; position: relative;
    background: var(--card-bg, #fff);
    border: 2px solid transparent;
    border-radius: var(--border-radius, 14px);
    padding: 2.8rem 1.5rem 2rem;
    text-align: center;
    box-shadow: var(--box-shadow, 0 1px 3px rgba(0,0,0,0.04));
    overflow: hidden; transition: all 0.3s ease;
}
.cp-dropzone::after {
    content: ''; position: absolute;
    top: 1rem; left: 1rem; right: 1rem; bottom: 1rem;
    border: 2px dashed #c7d2fe; border-radius: 12px;
    pointer-events: none; z-index: 1;
}
.cp-dropzone-icon, .cp-dropzone-text, .cp-dropzone-hint {
    transform: scale(0.625); transform-origin: center;
    position: relative; z-index: 2;
}
.cp-dropzone-icon { color: #9aa0a6; margin-bottom: 0; display: flex; justify-content: center; }
.cp-dropzone-icon svg { width: 100px; height: 100px; fill: none !important; filter: none !important; }
.cp-dropzone-text { font-size: 26px; font-weight: 600; color: #1a1a1a; margin-bottom: 0; }
.cp-dropzone-hint { font-size: 17px; color: #80868b; }
.cp-dropzone:hover, .cp-dropzone.dragover { transform: scale(1.6) translateY(-5px); }
.cp-dropzone:hover .cp-dropzone-icon, .cp-dropzone.dragover .cp-dropzone-icon { color: #4285f4; }
.cp-dropzone.dragover { background: #e8f0fe; }
.cp-dropzone.dragover::after { border-color: #4285f4; border-style: solid; }

@media (max-width: 768px) {
    .cp-dropzone { transform: scale(1.2); margin: 2rem auto !important; }
    .cp-dropzone:hover, .cp-dropzone.dragover { transform: scale(1.2) translateY(-5px); }
}
@media (max-width: 480px) {
    .cp-dropzone { transform: scale(1.0); margin: 1.5rem auto !important; }
    .cp-dropzone:hover, .cp-dropzone.dragover { transform: scale(1.0) translateY(-5px); }
}

.cp-error-banner {
    margin: 16px 0; padding: 14px 18px;
    background: #fce8e6; border: 1px solid #f28b82;
    border-radius: 10px; color: #b3261e; font-size: 14px; line-height: 1.5;
}

body:has(.image-preview-container[style*="display: block"]) .idphoto-process-section {
    display: none !important;
}

.cp-privacy-note {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 0.5rem; padding: 4px 12px;
    background: #ecfdf5; color: #047857;
    border-radius: 999px; font-size: 13px; font-weight: 600;
}

/* ==========================================================================
   Workspace: canvas (top) + sidebar (below) with zoom / color / history
   ========================================================================== */
.cp-canvas-row { margin-bottom: 1.25rem; }

/* Override .image-container default flex centering — picker canvas needs
   to fill the container at natural aspect ratio. */
.page-color-picker .cp-canvas-container {
    height: auto;
    min-height: 300px;
    max-height: 600px;
    padding: 8px;
}
.cp-canvas {
    display: block;
    max-width: 100%;
    max-height: 580px;
    width: auto;
    height: auto;
    object-fit: contain;
    cursor: crosshair;
    /* subtle checkerboard so transparent PNGs read as transparent */
    background:
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%) 0 0 / 20px 20px,
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%) 10px 10px / 20px 20px,
        #ffffff;
}

/* Sidebar: horizontal flex of 3 panels on desktop, stacked on mobile */
.cp-sidebar {
    display: flex;
    gap: 1rem;
    align-items: stretch;
}
@media (max-width: 900px) {
    .cp-sidebar { flex-direction: column; }
}

.cp-panel {
    flex: 1;
    background: var(--card-bg, #fff);
    border: 1px solid #e5e7eb;
    border-radius: var(--border-radius, 12px);
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;  /* allows flex children to shrink */
}
.cp-panel-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 0.75rem;
    align-self: flex-start;
}
.cp-history-hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: #9ca3af;
    margin-left: 6px;
}

/* ── Zoom magnifier ───────────────────────────────────────────────────── */
.cp-zoom-canvas {
    width: 168px;
    height: 168px;
    image-rendering: pixelated;     /* crisp pixels when scaled */
    image-rendering: -moz-crisp-edges;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}
.cp-zoom-coords {
    margin-top: 0.5rem;
    font-size: 12px;
    color: #6b7280;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    text-align: center;
}

/* ── Color display ────────────────────────────────────────────────────── */
.cp-color-swatch {
    width: 100%;
    height: 80px;
    background: #f3f4f6;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    margin-bottom: 0.75rem;
    transition: background-color 0.05s linear;
}
.cp-color-values {
    display: flex;
    gap: 4px;
    margin-bottom: 0.5rem;
    width: 100%;
}
.cp-format-btn {
    flex: 1;
    padding: 6px 0;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s ease;
}
.cp-format-btn:hover { background: #e5e7eb; color: #1a1a1a; }
.cp-format-btn.active {
    background: var(--primary-color, #6366f1);
    border-color: var(--primary-color, #6366f1);
    color: white;
}
.cp-color-readout {
    width: 100%;
    padding: 8px 10px;
    background: #111827;
    color: #f9fafb;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    text-align: center;
    margin-bottom: 0.5rem;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    word-break: break-all;
}
.cp-copy-button {
    width: 100%;
    padding: 8px 0;
    background: var(--primary-color, #6366f1);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}
.cp-copy-button:hover { background: #4338ca; }
.cp-copy-button:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* ── History ──────────────────────────────────────────────────────────── */
.cp-history-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
}
.cp-history-swatch {
    aspect-ratio: 1;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.cp-history-swatch:hover {
    transform: scale(1.08);
    border-color: var(--primary-color, #6366f1);
}
.cp-history-swatch::after {
    content: attr(data-hex);
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: #6b7280;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}
.cp-history-swatch:hover::after { opacity: 1; }
.cp-history-empty {
    grid-column: 1 / -1;
    padding: 1.5rem 0.5rem;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
    font-style: italic;
}
