/* ============================================
   HEXTONE - Stylesheet v2
   ============================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    min-height: 100vh;
    background: linear-gradient(160deg, #0a0a0f 0%, #12121f 40%, #0d1117 100%);
    font-family: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
    color: #e4e4e7;
    line-height: 1.6;
    overflow-x: hidden;
}

.noise-overlay {
    position: fixed; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.03; pointer-events: none; z-index: 0;
}

.hextone-container {
    max-width: 720px; margin: 0 auto;
    padding: 24px 16px 60px; position: relative; z-index: 1;
}
@media (min-width: 640px) { .hextone-container { padding: 48px 24px 80px; } }

/* === Header === */
.hextone-header { text-align: center; margin-bottom: 40px; position: relative; }
.hextone-glow {
    position: absolute; top: -40px; left: 50%; transform: translateX(-50%);
    width: 300px; height: 120px;
    background: radial-gradient(ellipse, rgba(139,92,246,0.15) 0%, transparent 70%);
    pointer-events: none; z-index: 0;
}
.hextone-logo {
    font-family: 'JetBrains Mono', monospace; font-size: 42px; font-weight: 700;
    letter-spacing: -2px;
    background: linear-gradient(135deg, #a78bfa 0%, #818cf8 30%, #6ee7b7 70%, #34d399 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; margin-bottom: 8px; position: relative; z-index: 1;
}
@media (min-width: 640px) { .hextone-logo { font-size: 56px; } }
.hextone-subtitle { font-size: 14px; color: #71717a; font-weight: 400; letter-spacing: 0.5px; }

/* === Tab Bar === */
.tab-bar {
    display: flex; gap: 4px; background: rgba(255,255,255,0.04);
    border-radius: 14px; padding: 4px; margin-bottom: 32px;
    border: 1px solid rgba(255,255,255,0.06);
    flex-wrap: wrap;
}
.tab-btn {
    flex: 1 1 auto; padding: 10px 8px; border: none; border-radius: 11px;
    font-family: 'DM Sans', system-ui, sans-serif; font-size: 12px; font-weight: 500;
    cursor: pointer; transition: all 0.25s ease; background: transparent; color: #71717a;
    display: flex; align-items: center; justify-content: center; gap: 4px;
    min-width: 0; white-space: nowrap;
}
@media (min-width: 640px) { .tab-btn { font-size: 15px; padding: 14px 20px; gap: 8px; } }
@media (max-width: 400px) {
    .tab-btn { font-size: 11px; padding: 9px 6px; gap: 3px; }
    .tab-icon { font-size: 14px; }
}
.tab-btn.active { background: rgba(139,92,246,0.15); color: #c4b5fd; box-shadow: 0 0 20px rgba(139,92,246,0.1); }
.tab-btn:hover:not(.active) { background: rgba(255,255,255,0.04); color: #a1a1aa; }
.tab-icon { font-size: 18px; }

/* === Search Section === */
.search-section { display: none; }
.search-section.active { display: block; }
.input-group { position: relative; margin-bottom: 16px; }
.input-label {
    display: block; font-size: 12px; font-weight: 500; color: #71717a;
    text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 8px;
}

/* === HEX Input === */
.hex-input-wrapper {
    display: flex; align-items: center; background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08); border-radius: 12px;
    overflow: hidden; transition: border-color 0.2s, box-shadow 0.2s;
}
.hex-input-wrapper:focus-within { border-color: rgba(139,92,246,0.4); box-shadow: 0 0 0 3px rgba(139,92,246,0.1); }
.hex-prefix { padding: 14px 0 14px 16px; font-family: 'JetBrains Mono', monospace; font-size: 18px; color: #52525b; user-select: none; }
.hex-input {
    flex: 1; padding: 14px 16px 14px 4px; background: transparent; border: none; outline: none;
    font-family: 'JetBrains Mono', monospace; font-size: 18px; color: #e4e4e7;
    letter-spacing: 1px; text-transform: uppercase; min-width: 0;
}
.hex-input::placeholder { color: #3f3f46; }
.hex-color-preview {
    width: 48px; height: 48px; border-radius: 8px; margin: 4px;
    border: 2px solid rgba(255,255,255,0.1); transition: background-color 0.2s;
    flex-shrink: 0; background-color: #27272a;
}

/* === Pantone Input === */
.pantone-input {
    width: 100%; padding: 14px 16px; background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; outline: none;
    font-family: 'DM Sans', system-ui, sans-serif; font-size: 16px; color: #e4e4e7; transition: all 0.2s;
}
.pantone-input:focus { border-color: rgba(110,231,183,0.4); box-shadow: 0 0 0 3px rgba(110,231,183,0.1); }
.pantone-input::placeholder { color: #3f3f46; }

/* === Search Button === */
.search-btn {
    width: 100%; padding: 14px;
    background: linear-gradient(135deg, rgba(139,92,246,0.3) 0%, rgba(99,102,241,0.3) 100%);
    border: 1px solid rgba(139,92,246,0.3); border-radius: 12px; color: #c4b5fd;
    font-family: 'DM Sans', system-ui, sans-serif; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: all 0.25s; letter-spacing: 0.5px;
}
.search-btn:hover { background: linear-gradient(135deg, rgba(139,92,246,0.45) 0%, rgba(99,102,241,0.45) 100%); box-shadow: 0 4px 24px rgba(139,92,246,0.2); transform: translateY(-1px); }
.search-btn:active { transform: translateY(0); }
.search-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* === Best Match Hero === */
.best-match {
    margin-top: 28px; border-radius: 16px; overflow: hidden;
    border: 1px solid rgba(139,92,246,0.2);
    background: linear-gradient(135deg, rgba(139,92,246,0.06) 0%, rgba(110,231,183,0.04) 100%);
    animation: fadeIn 0.3s ease;
}
.best-match-header {
    padding: 12px 20px; font-size: 12px; font-weight: 600; color: #a78bfa;
    text-transform: uppercase; letter-spacing: 1.5px;
    border-bottom: 1px solid rgba(139,92,246,0.1);
    display: flex; align-items: center; gap: 8px;
}
.best-match-body { display: flex; align-items: stretch; }
.best-match-swatch { width: 120px; min-height: 110px; flex-shrink: 0; }
@media (min-width: 640px) { .best-match-swatch { width: 160px; min-height: 130px; } }
.best-match-info { flex: 1; padding: 20px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.best-match-name { font-weight: 700; font-size: 20px; color: #e4e4e7; }
.best-match-hex { font-family: 'JetBrains Mono', monospace; font-size: 15px; color: #a1a1aa; }
.best-match-meta { display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; }

/* === Suggestions Dropdown === */
.suggestions-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
    background: #1e1e2e; border: 1px solid rgba(255,255,255,0.1); border-radius: 12px;
    margin-top: 4px; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    max-height: 360px; overflow-y: auto; animation: dropIn 0.15s ease;
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.suggestion-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    cursor: pointer; transition: background 0.15s; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover, .suggestion-item.active { background: rgba(139,92,246,0.1); }
.suggestion-swatch { width: 32px; height: 32px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.1); flex-shrink: 0; }
.suggestion-name { font-weight: 500; font-size: 14px; color: #e4e4e7; }
.suggestion-hex { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #71717a; }

/* === Results Section === */
.results-section { margin-top: 24px; }

/* === Group Headers === */
.group-header {
    display: flex; align-items: center; gap: 10px;
    margin: 28px 0 12px; padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.group-header:first-child { margin-top: 0; }
.group-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.group-dot-exact { background: #34d399; box-shadow: 0 0 8px rgba(52,211,153,0.4); }
.group-dot-veryclose { background: #6ee7b7; }
.group-dot-close { background: #fbbf24; }
.group-dot-similar { background: #f97316; }
.group-dot-far { background: #ef4444; }
.group-title { font-size: 13px; font-weight: 600; color: #a1a1aa; }
.group-subtitle { font-size: 11px; color: #52525b; }
.group-count {
    margin-left: auto; font-size: 11px; color: #52525b;
    background: rgba(255,255,255,0.04); padding: 2px 8px; border-radius: 10px;
}

/* === Result Card === */
.result-card {
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px; overflow: hidden; margin-bottom: 8px; transition: all 0.25s;
}
.result-card:hover { border-color: rgba(255,255,255,0.12); box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
.result-card-top { display: flex; align-items: stretch; }
.result-swatch { width: 64px; min-height: 64px; flex-shrink: 0; }
@media (min-width: 640px) { .result-swatch { width: 80px; min-height: 72px; } }
.result-info { flex: 1; padding: 12px 16px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.result-pantone-name { font-weight: 600; font-size: 15px; color: #e4e4e7; }
.result-hex { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: #a1a1aa; }
.result-distance { font-size: 11px; color: #52525b; }

/* === Match Badges === */
.match-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.5px; width: fit-content;
}
.match-exact { background: rgba(52,211,153,0.15); color: #6ee7b7; border: 1px solid rgba(52,211,153,0.2); }
.match-veryclose { background: rgba(110,231,183,0.12); color: #a7f3d0; border: 1px solid rgba(110,231,183,0.2); }
.match-close { background: rgba(251,191,36,0.12); color: #fde68a; border: 1px solid rgba(251,191,36,0.2); }
.match-similar { background: rgba(249,115,22,0.12); color: #fdba74; border: 1px solid rgba(249,115,22,0.15); }
.match-far { background: rgba(248,113,113,0.12); color: #fca5a5; border: 1px solid rgba(248,113,113,0.15); }

.de-badge {
    font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #71717a;
    background: rgba(255,255,255,0.04); padding: 2px 8px; border-radius: 8px;
}

/* === Delta E Info Section === */
.delta-e-info {
    margin-top: 32px; border-radius: 14px; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
}
.delta-e-toggle {
    width: 100%; padding: 16px 20px; border: none; background: transparent;
    color: #a1a1aa; font-family: 'DM Sans', system-ui, sans-serif; font-size: 14px;
    font-weight: 500; cursor: pointer; display: flex; align-items: center;
    justify-content: space-between; transition: color 0.2s;
}
.delta-e-toggle:hover { color: #c4b5fd; }
.toggle-arrow { font-size: 12px; transition: transform 0.3s; }
.toggle-arrow.open { transform: rotate(180deg); }
.delta-e-content { padding: 0 20px 20px; animation: fadeIn 0.3s ease; }
.delta-e-intro { font-size: 14px; color: #a1a1aa; line-height: 1.7; margin-bottom: 20px; }
.delta-e-intro strong { color: #c4b5fd; }
.delta-e-scale { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.de-level { display: flex; align-items: center; gap: 12px; }
.de-bar { width: 6px; height: 40px; border-radius: 3px; flex-shrink: 0; }
.de-bar-exact { background: #34d399; }
.de-bar-veryclose { background: #6ee7b7; }
.de-bar-close { background: #fbbf24; }
.de-bar-similar { background: #f97316; }
.de-bar-far { background: #ef4444; }
.de-bar-veryfar { background: #7f1d1d; }
.de-info { display: flex; flex-direction: column; gap: 2px; }
.de-range { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600; color: #e4e4e7; }
.de-desc { font-size: 12px; color: #71717a; line-height: 1.5; }
.delta-e-note { font-size: 12px; color: #52525b; line-height: 1.6; border-top: 1px solid rgba(255,255,255,0.04); padding-top: 16px; }
.delta-e-note strong { color: #71717a; }

/* === Detail Card === */
.detail-card {
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px; overflow: hidden; margin-top: 24px; animation: dropIn 0.2s ease;
}
.detail-swatch { height: 160px; display: flex; align-items: flex-end; padding: 20px; position: relative; }
@media (min-width: 640px) { .detail-swatch { height: 200px; } }
.detail-swatch-label {
    font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 14px;
    padding: 6px 14px; border-radius: 8px; backdrop-filter: blur(8px);
}
.detail-info { padding: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (min-width: 640px) { .detail-info { grid-template-columns: 1fr 1fr 1fr 1fr; } }
.detail-field-label { font-size: 11px; color: #52525b; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.detail-field-value { font-family: 'JetBrains Mono', monospace; font-size: 15px; color: #e4e4e7; font-weight: 500; }

/* === Eyedropper / Výběr z obrázku === */
.eyedropper-file-input {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.eyedropper-dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 48px 24px; border: 2px dashed rgba(255,255,255,0.1); border-radius: 14px;
    background: rgba(255,255,255,0.02); cursor: pointer; transition: all 0.25s;
    text-align: center; gap: 8px;
}
.eyedropper-dropzone:hover, .eyedropper-dropzone.drag-over {
    border-color: rgba(139,92,246,0.4); background: rgba(139,92,246,0.06);
}
.dropzone-icon { font-size: 36px; margin-bottom: 4px; }
.dropzone-text { font-size: 15px; color: #a1a1aa; font-weight: 500; }
.dropzone-hint { font-size: 12px; color: #52525b; margin-top: 4px; }

.eyedropper-canvas-wrap { animation: fadeIn 0.3s ease; }
.eyedropper-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.eyedropper-preview-bar {
    display: flex; align-items: center; gap: 12px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px; padding: 8px 16px; flex: 1; min-width: 200px;
}
.eyedropper-swatch {
    width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.15); background: #000;
    transition: background-color 0.05s;
}
.eyedropper-color-info { display: flex; flex-direction: column; gap: 2px; }
.eyedropper-hex-val {
    font-family: 'JetBrains Mono', monospace; font-size: 16px; font-weight: 600; color: #e4e4e7;
}
.eyedropper-rgb-val {
    font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #71717a;
}
.eyedropper-use-btn {
    padding: 12px 20px; border: none; border-radius: 10px; cursor: pointer;
    font-family: 'DM Sans', system-ui, sans-serif; font-size: 14px; font-weight: 600;
    background: linear-gradient(135deg, rgba(52,211,153,0.25) 0%, rgba(110,231,183,0.2) 100%);
    border: 1px solid rgba(52,211,153,0.3); color: #6ee7b7;
    transition: all 0.25s; white-space: nowrap;
}
.eyedropper-use-btn:hover {
    background: linear-gradient(135deg, rgba(52,211,153,0.4) 0%, rgba(110,231,183,0.35) 100%);
    box-shadow: 0 4px 20px rgba(52,211,153,0.15);
}

.eyedropper-canvas-container {
    position: relative; border-radius: 12px; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08); background: #0a0a0f;
    cursor: crosshair;
}
#eyedropper-canvas {
    display: block; width: 100%; height: auto;
    max-height: 60vh;
}
.eyedropper-loupe {
    position: absolute; pointer-events: none; z-index: 10;
    width: 110px; height: 110px; border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.8); overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(0,0,0,0.3);
    transform: translate(-50%, -50%);
}
#eyedropper-loupe-canvas { display: block; width: 110px; height: 110px; }
.eyedropper-crosshair {
    position: absolute; top: 50%; left: 50%;
    width: 11px; height: 11px;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.eyedropper-hint-bar {
    text-align: center; padding: 10px; font-size: 12px; color: #52525b;
}
.eyedropper-reset-btn {
    width: 100%; padding: 10px; margin-top: 4px;
    background: transparent; border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px; color: #71717a; font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px; cursor: pointer; transition: all 0.2s;
}
.eyedropper-reset-btn:hover { border-color: rgba(255,255,255,0.15); color: #a1a1aa; }

@media (max-width: 480px) {
    .eyedropper-toolbar { flex-direction: column; }
    .eyedropper-use-btn { width: 100%; }
    .eyedropper-loupe { width: 90px; height: 90px; }
    #eyedropper-loupe-canvas { width: 90px; height: 90px; }
}

/* === Footer === */
.footer-text { text-align: center; margin-top: 48px; font-size: 12px; color: #3f3f46; line-height: 1.8; }

/* === Scrollbar === */
.suggestions-dropdown::-webkit-scrollbar { width: 6px; }
.suggestions-dropdown::-webkit-scrollbar-track { background: transparent; }
.suggestions-dropdown::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
.suggestions-dropdown::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
