/* ==========================================================================
   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-icon img { width: 128px; height: 128px; border-radius: 20px; margin: -14px 0; }
.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: standard two-column (image left, picker panels right)
   ========================================================================== */

/* The picker canvas lives inside the standard .image-container (450px tall,
   flex-centered). Canvas element scales like an <img> via max-width/height
   while keeping its intrinsic aspect ratio (set via width/height attrs). */
.cp-canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    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;
}

/* Right column: stack the three panels vertically inside .compressed-image */
.cp-picker-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cp-panel {
    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: 500;
    text-transform: none;
    letter-spacing: 0;
    color: #6b7280;
    margin-left: 6px;
    font-size: 13px;
}

/* ── 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: 14px;
    color: #4b5563;
    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(5, 1fr);   /* 5 per row × 2 rows = 10 slots */
    gap: 6px;
    width: 100%;
}
.cp-history-swatch {
    aspect-ratio: 1;
    border-radius: 6px;
    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.12);
    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;
}

/* ==========================================================================
   Click marker — white dot drawn at the last pick position
   ========================================================================== */
.cp-marker {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #111827;
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.6),
        0 1px 4px rgba(0, 0, 0, 0.45);
    transform: translate(-50%, -50%);
    pointer-events: none;       /* don't intercept mousemove */
    z-index: 6;
    transition: left 0.08s ease-out, top 0.08s ease-out;
}
.cp-marker[hidden] { display: none; }

/* ==========================================================================
   Current Color — three always-visible HEX/RGB/HSL rows
   (replaces the previous toggle + single-readout layout)
   ========================================================================== */
.cp-color-lines {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
}
.cp-color-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 7px 10px;
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 6px;
    font-size: 13px;
}
.cp-format-label {
    flex-shrink: 0;
    width: 38px;
    color: #6b7280;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.cp-format-value {
    flex: 1;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: #111827;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cp-copy-line-btn {
    flex-shrink: 0;
    padding: 4px 10px;
    background: var(--primary-color, #6366f1);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}
.cp-copy-line-btn:hover:not(:disabled) { background: #4338ca; }
.cp-copy-line-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* Hide HowTo AND SEO section once user enters production page */
body:has(.image-preview-container[style*="display: block"]) .idphoto-process-section,
body:has(.image-preview-container[style*="display: block"]) .cp-seo-section {
    display: none !important;
}

/* ==========================================================================
   SEO knowledge section — long-form content below the How-To
   ========================================================================== */
.cp-seo-section {
    max-width: 1200px;
    margin: 3rem auto 2rem;
    padding: 0 1rem;
    color: #374151;
    line-height: 1.7;
    font-size: 15px;
}
.cp-seo-section h2 {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    margin: 2.25rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #ede9fe;
}
.cp-seo-section h2:first-child { margin-top: 0; }
.cp-seo-section h3 {
    font-size: 17px;
    font-weight: 600;
    color: #4338ca;
    margin: 1.5rem 0 0.5rem;
}
.cp-seo-section p { margin: 0 0 0.85rem; }
.cp-seo-section strong { color: #111827; }
.cp-seo-section em { color: #6b7280; font-style: italic; }
.cp-seo-section code {
    background: #f3f4f6;
    padding: 1px 6px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
    color: #4338ca;
}
.cp-seo-section kbd {
    background: #fff;
    border: 1px solid #d1d5db;
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 1px 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: #374151;
}

.cp-doc-list,
.cp-seo-section ol {
    margin: 0 0 1rem;
    padding-left: 1.5rem;
}
.cp-doc-list li,
.cp-seo-section ol li {
    margin: 0.35rem 0;
    line-height: 1.65;
}

.cp-doc-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0 1.25rem;
    font-size: 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}
.cp-doc-table th,
.cp-doc-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
}
.cp-doc-table th {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    color: #4338ca;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.cp-doc-table tr:last-child td { border-bottom: none; }
.cp-doc-table tr:nth-child(even) td { background: #fafbfc; }

.cp-faq h3 { margin-top: 1.75rem; }
.cp-faq h3::before {
    content: 'Q.';
    color: #4338ca;
    font-weight: 800;
    margin-right: 0.5rem;
}

/* Screenshot — full-width inside the .cp-seo-section container */
.cp-screenshot {
    margin: 1.5rem 0 2rem;
    padding: 0;
}
.cp-screenshot-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.cp-screenshot figcaption {
    margin-top: 0.6rem;
    text-align: center;
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640px) {
    .cp-seo-section { padding: 0 0.75rem; font-size: 14px; }
    .cp-seo-section h2 { font-size: 19px; }
    .cp-seo-section h3 { font-size: 15px; }
    .cp-doc-table { font-size: 13px; }
    .cp-doc-table th, .cp-doc-table td { padding: 8px; }
}
