/* ============================================================
   Neon Color Palette Extractor PRO — Style Sheet
   Design System: Neon Dark (matches DarksteadyHub suite)
   ============================================================ */

/* --- CSS Variables --- */
:root {
    --bg-color: #0a0a0a;
    --surface-color: #141414;
    --surface-light: #222;
    --surface-hover: #2a2a2a;
    --primary-color: #a3ff00;
    --primary-glow: rgba(163, 255, 0, 0.4);
    --primary-dim: rgba(163, 255, 0, 0.15);
    --danger-color: #ff4444;
    --warning-color: #ffaa00;
    --success-color: #00e676;
    --text-color: #ffffff;
    --text-muted: #888899;
    --border-color: #333;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 2rem;
    min-height: 100vh;
    background-image: radial-gradient(
        circle at 50% 0%,
        rgba(163, 255, 0, 0.08) 0%,
        transparent 70%
    );
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- App Container --- */
.app-container {
    width: 100%;
    max-width: 1400px;
    padding: 2.5rem;
    background: rgba(20, 20, 20, 0.7);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 32px;
    box-shadow:
        0 30px 60px rgba(0, 0, 0, 0.8),
        inset 0 0 0 1px rgba(163, 255, 0, 0.1);
    margin: 0 2rem 4rem;
    position: relative;
}

/* --- Header --- */
header {
    text-align: center;
    margin-bottom: 2.5rem;
}

h1 {
    font-size: 2.6rem;
    font-weight: 800;
    letter-spacing: -1px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}

.badge {
    font-size: 1rem;
    background: var(--primary-color);
    color: var(--bg-color);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    text-transform: uppercase;
    font-weight: 800;
    box-shadow: 0 0 15px var(--primary-glow);
    line-height: 1.4;
}

.highlight {
    color: var(--primary-color);
    text-shadow: 0 0 20px var(--primary-glow);
}

header p {
    color: var(--text-muted);
    font-size: 1.05rem;
    font-weight: 300;
}

/* --- Drop Zone --- */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 20px;
    padding: 5rem 2rem 3rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(163, 255, 0, 0.04);
    box-shadow: 0 0 40px rgba(163, 255, 0, 0.1) inset;
}

.drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    pointer-events: none;
}

.drop-content p {
    font-size: 1.2rem;
    font-weight: 600;
}

.drop-content svg {
    color: var(--primary-color);
    filter: drop-shadow(0 0 15px var(--primary-glow));
    transition: var(--transition);
}

.drop-zone:hover .drop-content svg {
    transform: translateY(-8px) scale(1.1);
}

.drop-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.5px;
}

.paste-hint {
    margin-top: 1.2rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    pointer-events: none;
}

.paste-hint kbd {
    display: inline-block;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-family: 'Outfit', sans-serif;
    font-size: 0.78rem;
    color: var(--primary-color);
    box-shadow: 0 2px 0 var(--border-color);
}

/* --- Utility --- */
.hidden {
    display: none !important;
}

/* --- Editor Layout --- */
.editor {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    position: relative;
    align-items: flex-start;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Sidebar --- */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--surface-color);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    position: sticky;
    top: 2rem;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.8rem;
}

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

/* --- Image Thumbnail --- */
.image-thumb-wrap {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    aspect-ratio: 16/10;
}

.image-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumb-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 0.4rem 0.6rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* --- Settings Blocks --- */
.settings-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.toggle-label {
    justify-content: space-between;
    flex-direction: row;
    font-size: 0.75rem;
}

.toggle-label span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-track {
    position: absolute;
    inset: 0;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    transition: var(--transition);
}

.toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch input:checked + .toggle-track {
    background: rgba(163, 255, 0, 0.2);
    border-color: var(--primary-color);
    box-shadow: 0 0 8px var(--primary-dim);
}

.toggle-switch input:checked + .toggle-track::after {
    background: var(--primary-color);
    left: calc(100% - 16px);
    box-shadow: 0 0 8px var(--primary-glow);
}

/* Color Count Row */
.color-count-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.value-label {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-glow);
    min-width: 20px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* --- Buttons --- */
.btn {
    background: transparent;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-color);
    outline: none;
    font-family: 'Outfit', sans-serif;
}

.btn-small {
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    background: var(--surface-light);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    transition: var(--transition);
}

.btn-small:hover {
    background: var(--primary-color);
    color: var(--bg-color);
    border-color: var(--primary-color);
}

.btn-danger-subtle {
    color: var(--danger-color);
}

.btn-danger-subtle:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--bg-color);
    padding: 0.9rem 1.5rem;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.95rem;
    gap: 0.5rem;
    box-shadow: 0 0 20px var(--primary-glow);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    width: 100%;
    justify-content: center;
    border: none;
    font-family: 'Outfit', sans-serif;
}

.btn-primary:hover {
    box-shadow: 0 0 35px var(--primary-glow);
    transform: translateY(-2px);
}

.btn-extract {
    margin-top: 0.4rem;
}

/* --- Pro Slider --- */
.pro-slider {
    flex-grow: 1;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: transparent;
    height: 4px;
    cursor: pointer;
    width: 100%;
}

.pro-slider:focus { outline: none; }

.pro-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
}

.pro-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 10px var(--primary-glow);
    border: none;
    transition: box-shadow 0.2s ease;
}

.pro-slider::-webkit-slider-thumb:hover {
    box-shadow: 0 0 18px var(--primary-glow);
}

.pro-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    border: none;
}

.pro-slider::-moz-range-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 0 10px var(--primary-glow);
    border: none;
}

/* --- Pro Select --- */
.pro-select {
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.6rem 2.2rem 0.6rem 0.8rem;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888899' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    width: 100%;
}

.pro-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(163, 255, 0, 0.15);
}

.pro-select option {
    background: var(--surface-color);
    color: var(--text-color);
}

/* --- Main Editor --- */
.main-editor {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

/* --- Preview Container --- */
.preview-container {
    background: var(--surface-light);
    border-radius: 20px;
    padding: 1.2rem 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 5px 15px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-chips {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.format-tag {
    font-size: 0.65rem;
    background: rgba(163, 255, 0, 0.15);
    color: var(--primary-color);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-chip {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.preview-wrapper {
    width: 100%;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 12px;
    background:
        repeating-conic-gradient(
            rgba(255, 255, 255, 0.03) 0% 25%,
            transparent 0% 50%
        ) 50% / 20px 20px;
}

#image-preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

/* --- Palette Panel --- */
.palette-panel {
    background: var(--surface-color);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    animation: fadeIn 0.4s ease;
}

.palette-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.8rem;
}

.palette-actions {
    display: flex;
    gap: 0.5rem;
}

/* --- Swatches Grid --- */
.swatches-grid {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.swatch-card {
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
    flex: 1;
    min-width: 90px;
    max-width: 130px;
    animation: swatchIn 0.4s ease both;
    background: var(--surface-light);
}

@keyframes swatchIn {
    from { opacity: 0; transform: scale(0.85) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.swatch-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border-color: rgba(163, 255, 0, 0.3);
}

.swatch-color {
    width: 100%;
    aspect-ratio: 1;
    position: relative;
    transition: var(--transition);
}

.swatch-copy-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    background: rgba(0,0,0,0.35);
    transition: var(--transition);
    border-radius: 0;
}

.swatch-copy-icon svg {
    color: white;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.8));
}

.swatch-card:hover .swatch-copy-icon {
    opacity: 1;
}

.swatch-info {
    padding: 0.5rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.swatch-hex {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-color);
    font-variant-numeric: tabular-nums;
}

.swatch-hsl {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.swatch-pct {
    font-size: 0.62rem;
    color: var(--primary-color);
    font-weight: 700;
    margin-top: 0.1rem;
}

/* Locked swatch */
.swatch-card.locked {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(163, 255, 0, 0.15);
}

.swatch-lock-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.6);
    border: none;
    border-radius: 6px;
    padding: 3px;
    cursor: pointer;
    opacity: 0;
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
}

.swatch-card:hover .swatch-lock-btn,
.swatch-card.locked .swatch-lock-btn {
    opacity: 1;
}

.swatch-card.locked .swatch-lock-btn {
    color: var(--primary-color);
}

/* --- Export Section --- */
.export-section {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
}

.export-tabs {
    display: flex;
    background: var(--surface-light);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: none;
}

.export-tabs::-webkit-scrollbar { display: none; }

.export-tab {
    background: none;
    border: none;
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: 'Outfit', sans-serif;
    border-bottom: 2px solid transparent;
    flex-shrink: 0;
}

.export-tab:hover {
    color: var(--text-color);
    background: var(--surface-hover);
}

.export-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-dim);
}

.export-output-wrap {
    position: relative;
}

.export-output {
    background: var(--bg-color);
    color: var(--text-color);
    font-family: 'Outfit', monospace;
    font-size: 0.8rem;
    padding: 1rem 3rem 1rem 1rem;
    line-height: 1.7;
    overflow-x: auto;
    white-space: pre;
    min-height: 80px;
    max-height: 180px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.export-output::-webkit-scrollbar { width: 5px; height: 5px; }
.export-output::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.btn-copy-code {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    gap: 0.3rem;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.btn-copy-code:hover {
    background: var(--primary-color);
    color: var(--bg-color);
}

/* --- WCAG Contrast Section --- */
.contrast-section {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-hint {
    font-size: 0.68rem;
    font-weight: 400;
    text-transform: none;
    color: var(--border-color);
    margin-left: auto;
    letter-spacing: 0;
}

.contrast-grid {
    display: grid;
    gap: 4px;
    /* columns set dynamically via JS */
}

.contrast-cell {
    aspect-ratio: 1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.contrast-cell:hover {
    transform: scale(1.1);
    z-index: 2;
    border-color: rgba(255,255,255,0.3);
}

.contrast-cell.aaa {
    background: rgba(0, 230, 118, 0.15);
    color: #00e676;
    border-color: rgba(0, 230, 118, 0.3);
}

.contrast-cell.aa {
    background: rgba(163, 255, 0, 0.12);
    color: var(--primary-color);
    border-color: rgba(163, 255, 0, 0.25);
}

.contrast-cell.aa-large {
    background: rgba(255, 170, 0, 0.12);
    color: var(--warning-color);
    border-color: rgba(255, 170, 0, 0.25);
}

.contrast-cell.fail {
    background: rgba(255, 68, 68, 0.1);
    color: var(--danger-color);
    border-color: rgba(255, 68, 68, 0.2);
}

.contrast-cell.same {
    background: var(--surface-light);
    color: var(--border-color);
}

/* --- History Panel --- */
.history-panel {
    background: var(--surface-color);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    animation: fadeIn 0.4s ease;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1rem;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem;
    background: var(--surface-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    border-color: rgba(163, 255, 0, 0.3);
}

.history-swatches {
    display: flex;
    gap: 3px;
}

.history-dot {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}

.history-meta {
    flex-grow: 1;
    min-width: 0;
}

.history-name {
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-date {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* --- Loading Overlay --- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    gap: 1.2rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.9s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    box-shadow: 0 0 20px var(--primary-glow);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-glow);
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--surface-light);
    border: 1px solid var(--primary-color);
    color: var(--text-color);
    padding: 0.7rem 1.4rem;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 0 20px rgba(163, 255, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 200;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Scrollbar Global --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   COLOR PICKER — Toolbar, Loupe, HUD, Picked Swatches
   ============================================================ */

/* --- Preview Toolbar --- */
.preview-toolbar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem;
    background: var(--bg-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Outfit', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: var(--surface-light);
    color: var(--text-color);
}

.toolbar-btn.active {
    background: var(--primary-color);
    color: var(--bg-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 12px var(--primary-glow);
}

.toolbar-btn.picker-active {
    background: rgba(163, 255, 0, 0.15);
    color: var(--primary-color);
    border-color: rgba(163, 255, 0, 0.4);
    box-shadow: 0 0 10px rgba(163, 255, 0, 0.15);
}

.toolbar-sep {
    width: 1px;
    height: 22px;
    background: var(--border-color);
    margin: 0 0.2rem;
    flex-shrink: 0;
}

/* --- Preview wrapper (picker mode) --- */
.preview-wrapper {
    position: relative;
    overflow: hidden;
}

.preview-wrapper.picker-mode {
    cursor: crosshair;
}

/* --- Picker Overlay Canvas --- */
.picker-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.picker-canvas.active {
    opacity: 1;
    pointer-events: auto;
    cursor: crosshair;
}

/* --- Magnifier Loupe --- */
.loupe {
    position: absolute;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.8),
        0 0 25px var(--primary-glow),
        0 8px 32px rgba(0,0,0,0.8);
    pointer-events: none;
    overflow: hidden;
    z-index: 10;
    transform: translate(-50%, -110%);
    transition: opacity 0.15s ease;
    background: #000;
}

.loupe canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    border-radius: 50%;
}

.loupe-crosshair {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 50%;
}

.loupe-crosshair::before,
.loupe-crosshair::after {
    content: '';
    position: absolute;
    background: rgba(255,255,255,0.6);
}

.loupe-crosshair::before {
    width: 1px;
    height: 100%;
    left: 50%;
    top: 0;
}

.loupe-crosshair::after {
    height: 1px;
    width: 100%;
    top: 50%;
    left: 0;
}

.loupe-color-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 22px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.loupe-hex {
    position: absolute;
    bottom: 4px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    font-family: 'Outfit', monospace;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
    color: #fff;
    mix-blend-mode: difference;
}

/* --- Color Info HUD --- */
.color-info-hud {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.8rem;
    background: var(--bg-color);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-top: 0;
    animation: fadeIn 0.2s ease;
    flex-wrap: wrap;
}

.hud-swatch {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.1);
    box-shadow: 0 0 12px rgba(0,0,0,0.5);
    transition: background 0.08s ease;
}

.hud-values {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex-grow: 1;
    min-width: 0;
}

.hud-hex {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: 0.5px;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 10px var(--primary-dim);
}

.hud-rgb,
.hud-hsl {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.hud-copy-btn {
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    padding: 0.35rem 0.5rem;
    border-radius: 7px;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    font-family: 'Outfit', sans-serif;
}

.hud-copy-btn:hover {
    background: var(--primary-color);
    color: var(--bg-color);
}

.hud-hint {
    font-size: 0.65rem;
    color: var(--border-color);
    font-weight: 400;
    white-space: nowrap;
    width: 100%;
    text-align: right;
}

/* --- Picked Colors (sidebar) --- */
.picked-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    animation: fadeIn 0.3s ease;
}

.picked-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.picked-dot {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    flex-shrink: 0;
    animation: swatchIn 0.25s ease both;
}

.picked-dot:hover {
    transform: scale(1.18);
    border-color: rgba(163, 255, 0, 0.5);
    box-shadow: 0 0 10px rgba(163, 255, 0, 0.2);
}

.picked-dot::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.picked-dot:hover::after {
    opacity: 1;
}

.picked-actions {
    display: flex;
    gap: 0.4rem;
}

.picked-actions .btn-small {
    flex: 1;
    justify-content: center;
}

/* Picked dot remove on right-click indicator */
.picked-dot .dot-remove {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 14px;
    height: 14px;
    background: var(--danger-color);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: white;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

.picked-dot:hover .dot-remove {
    display: flex;
}

/* --- Responsive --- */
@media (max-width: 960px) {
    .editor {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        position: static;
    }
    h1 {
        font-size: 2rem;
    }
}

@media (max-width: 600px) {
    .app-container {
        margin: 0 0.5rem 2rem;
        padding: 1.5rem;
        border-radius: 20px;
    }
    .swatches-grid {
        gap: 0.5rem;
    }
    .swatch-card {
        min-width: 70px;
    }
    h1 {
        font-size: 1.6rem;
        gap: 0.5rem;
    }
    .preview-toolbar {
        flex-wrap: wrap;
    }
    .loupe {
        display: none;
    }
}
