/* ============================================================
   Color Designer — Tools Shared CSS
   Responsive, dark-theme, touch-friendly
   ============================================================ */

/* Tool page wrapper */
.tool-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}
@media (min-width: 640px) { .tool-page { padding: 32px 24px 80px; } }
@media (min-width: 1024px) { .tool-page { padding: 48px 32px 100px; } }

/* Tool header */
.tool-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #2a2a2a;
}
.tool-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.tool-breadcrumb a { color: #888; text-decoration: none; }
.tool-breadcrumb a:hover { color: #ff5a1f; }
.tool-breadcrumb-sep { color: #444; }
.tool-title {
    font-size: clamp(24px, 5vw, 36px);
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 10px;
}
.tool-description {
    font-size: 16px;
    color: #888;
    line-height: 1.6;
    max-width: 700px;
}

/* Tool card (main interactive area) */
.tool-card {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 12px;
}
@media (min-width: 640px) { .tool-card { padding: 28px; } }
@media (min-width: 1024px) { .tool-card { padding: 36px; } }

/* Labels & Inputs */
.tool-label {
    font-size: 13px;
    font-weight: 500;
    color: #aaa;
    display: block;
    margin-bottom: 6px;
}
.tool-input {
    background: #222;
    border: 1px solid #333;
    border-radius: 8px;
    color: #e5e5e5;
    padding: 10px 14px;
    font-size: 14px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}
.tool-input:focus { border-color: #ff5a1f; }
.tool-input::placeholder { color: #555; }
.color-picker-input {
    width: 48px;
    height: 48px;
    border: 2px solid #333;
    border-radius: 10px;
    cursor: pointer;
    padding: 3px;
    background: transparent;
    flex-shrink: 0;
}
.color-picker-input:hover { border-color: #ff5a1f; }

/* Color swatch grid */
.swatch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
}
@media (max-width: 480px) {
    .swatch-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 6px; }
}
.swatch-wrap {
    cursor: pointer;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
    transition: transform 0.15s, box-shadow 0.15s;
    touch-action: manipulation;
}
.swatch-wrap:hover, .swatch-wrap:active { transform: scale(1.06); box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
.swatch-color {
    width: 100%;
    height: 52px;
}
@media (max-width: 480px) { .swatch-color { height: 44px; } }
.swatch-hex {
    display: block;
    font-size: 9px;
    text-align: center;
    color: #888;
    padding: 3px 2px;
    background: #111;
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tabs */
.tool-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: #111;
    border-radius: 12px;
    padding: 4px;
    flex-wrap: wrap;
}
.tool-tab {
    padding: 9px 16px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: #888;
    background: transparent;
    border: none;
    font-family: inherit;
    touch-action: manipulation;
    min-height: 40px;
}
.tool-tab.active { background: #ff5a1f; color: #fff; }
.tool-tab:hover:not(.active) { color: #fff; background: rgba(255,255,255,0.06); }
@media (max-width: 480px) { .tool-tab { padding: 8px 12px; font-size: 12px; } }

/* Buttons */
.btn-tool-primary {
    background: #ff5a1f;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 22px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    touch-action: manipulation;
    min-height: 44px;
    white-space: nowrap;
}
.btn-tool-primary:hover { background: #d03801; transform: translateY(-1px); }
.btn-tool-primary:active { transform: translateY(0); }

.btn-tool-secondary {
    background: #222;
    color: #ccc;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 10px 18px;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    touch-action: manipulation;
    min-height: 40px;
    white-space: nowrap;
}
.btn-tool-secondary:hover { background: #2a2a2a; border-color: #ff5a1f; color: #fff; }

/* Export row */
.tool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid #2a2a2a;
}

/* Range slider */
.tool-range {
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: #333;
    outline: none;
    width: 100%;
    cursor: pointer;
}
.tool-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ff5a1f;
    cursor: pointer;
    border: 2px solid #111;
    box-shadow: 0 0 6px rgba(255,90,31,0.4);
    touch-action: none;
}

/* Code output box */
.tool-code {
    background: #0d0d0d;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #a8ff78;
    overflow-x: auto;
    white-space: pre;
    line-height: 1.6;
    -webkit-overflow-scrolling: touch;
}

/* Select */
.tool-select {
    background: #222;
    border: 1px solid #333;
    border-radius: 8px;
    color: #e5e5e5;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    width: 100%;
    min-height: 44px;
}
.tool-select:focus { border-color: #ff5a1f; }
option { background: #222; }

/* Info badge */
.tool-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-pass { background: rgba(34,197,94,0.12); color: #22c55e; border: 1px solid rgba(34,197,94,0.25); }
.badge-fail { background: rgba(239,68,68,0.12); color: #ef4444; border: 1px solid rgba(239,68,68,0.25); }
.badge-aa   { background: rgba(59,130,246,0.12); color: #60a5fa; border: 1px solid rgba(59,130,246,0.25); }

/* Canvas */
.tool-canvas {
    border-radius: 12px;
    border: 1px solid #2a2a2a;
    max-width: 100%;
    display: block;
    touch-action: none;
}

/* Image upload area */
.upload-zone {
    border: 2px dashed #333;
    border-radius: 14px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    background: #111;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: #ff5a1f; background: rgba(255,90,31,0.04); }
.upload-zone input[type="file"] { display: none; }

/* Color value row */
.color-value-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    background: #111;
    border-radius: 8px;
    border: 1px solid #222;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.color-value-label { font-size: 12px; color: #666; font-weight: 500; flex-shrink: 0; }
.color-value-text { font-family: monospace; font-size: 13px; color: #e5e5e5; flex: 1; text-align: center; }

/* Related tools */
.related-tools-section { margin-top: 48px; }
.related-tools-section h2 {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 20px;
}
.tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
@media (min-width: 640px)  { .tools-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .tools-grid { grid-template-columns: repeat(4, 1fr); } }

.tool-card-link { text-decoration: none; }
.tool-card-mini {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.25s;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tool-card-mini:hover { border-color: #ff5a1f; transform: translateY(-2px); }
.tool-card-icon { font-size: 22px; }
.tool-card-name { font-size: 13px; font-weight: 600; color: #e5e5e5; }
.tool-card-link:hover .tool-card-name { color: #ff5a1f; }
.tool-card-desc { font-size: 11px; color: #666; line-height: 1.5; }

/* Article section */
.article-section {
    margin-top: 48px;
    padding: 32px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 16px;
}
.article-section h2 { font-size: 20px; font-weight: 700; color: #fff; margin: 24px 0 12px; }
.article-section h2:first-child { margin-top: 0; }
.article-section h3 { font-size: 16px; font-weight: 600; color: #e5e5e5; margin: 20px 0 8px; }
.article-section p { color: #888; font-size: 15px; line-height: 1.8; margin-bottom: 12px; }
.article-section ul, .article-section ol { color: #888; font-size: 15px; line-height: 1.8; padding-left: 24px; margin-bottom: 12px; }
.article-section li { margin-bottom: 6px; }
.article-section strong { color: #ccc; font-weight: 600; }
@media (max-width: 640px) { .article-section { padding: 20px; } }

/* FAQ section */
.faq-section { margin-top: 48px; }
.faq-section h2 { font-size: 22px; font-weight: 700; color: #fff; margin-bottom: 20px; }
.faq-item { border-bottom: 1px solid #2a2a2a; }
.faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 4px;
    cursor: pointer;
    background: transparent;
    border: none;
    color: #e5e5e5;
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    font-family: inherit;
    min-height: 56px;
    touch-action: manipulation;
}
.faq-question:hover { color: #ff5a1f; }
.faq-chevron {
    width: 18px;
    height: 18px;
    color: #ff5a1f;
    flex-shrink: 0;
    transition: transform 0.25s;
}
.faq-answer {
    padding: 0 4px 18px;
    color: #888;
    font-size: 14px;
    line-height: 1.75;
}

/* Divider */
.tool-divider {
    border: none;
    border-top: 1px solid #2a2a2a;
    margin: 24px 0;
}

/* Harmony row */
.harmony-row { margin-bottom: 24px; }
.harmony-row h4 {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

/* Comparison table */
.compare-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.compare-table th, .compare-table td { padding: 12px 14px; border-bottom: 1px solid #1e1e1e; text-align: left; }
.compare-table th { color: #666; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.compare-table td { color: #ccc; }
.compare-table tr:hover td { background: rgba(255,255,255,0.02); }
@media (max-width: 480px) { .compare-table th, .compare-table td { padding: 10px 8px; font-size: 12px; } }

/* Gradient bar */
.gradient-bar {
    width: 100%;
    height: 50px;
    border-radius: 10px;
    border: 1px solid #333;
    position: relative;
    cursor: crosshair;
    touch-action: none;
}
.gradient-stop-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 26px;
    border-radius: 4px;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    cursor: grab;
    touch-action: none;
}
.gradient-stop-marker.active { box-shadow: 0 0 0 2px #ff5a1f; }

/* Lock button (random gen) */
.lock-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: #fff;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
    touch-action: manipulation;
}
.lock-btn:hover { background: rgba(255,90,31,0.4); border-color: #ff5a1f; }
.lock-btn.locked { background: rgba(255,90,31,0.6); border-color: #ff5a1f; }

/* Color swatch palette (large) */
.palette-swatch {
    flex: 1;
    min-height: 120px;
    display: flex;
    align-items: flex-end;
    padding: 8px;
    position: relative;
    cursor: pointer;
    transition: flex 0.3s;
}
@media (max-width: 480px) { .palette-swatch { min-height: 80px; } }
.palette-swatch:hover { flex: 1.3; }
.palette-hex-badge {
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 10px;
    padding: 3px 7px;
    border-radius: 20px;
    font-family: monospace;
    opacity: 0;
    transition: opacity 0.2s;
    backdrop-filter: blur(4px);
    white-space: nowrap;
}
.palette-swatch:hover .palette-hex-badge { opacity: 1; }
