/* ============================================
   Image Color Picker - Tool Stylesheet
   Prefix: icp-
   Load order: custom_styles.css THEN this file
   ============================================ */

/* ---- Override tool-main overflow (custom_styles.css sets overflow:hidden) ---- */
.tool-main {
    overflow: visible !important;
}

/* ---- Tool Header ---- */
.icp-header {
    text-align: center;
    margin-bottom: 2rem;
}

.icp-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.875rem;
    margin-bottom: 0.75rem;
}

.icp-title-row svg,
.icp-title-row [data-lucide] {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    color: var(--color-2, #3399cc);
}

.icp-title {
    font-size: clamp(1.9rem, 5vw, 2.8rem);
    font-weight: 700;
    margin: 0;
    color: var(--color-2, #3399cc);
    letter-spacing: -0.02em;
}

.icp-description {
    font-size: 1.1rem;
    color: var(--text-secondary, #555);
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ---- Tool Main panel ---- */
.icp-tool-main {
    background: var(--bg-elevated, #fff);
    border-radius: var(--radius-xl, 16px);
    box-shadow: var(--shadow-xl, 0 20px 40px rgba(0,0,0,0.1));
    border: 1px solid var(--border-color, #e0e0e0);
    overflow: visible;
    transition: background-color var(--transition-speed, 0.25s),
                border-color var(--transition-speed, 0.25s);
}

/* ---- Upload Section ---- */
.icp-upload {
    padding: 2.5rem 2rem;
    text-align: center;
}

.icp-upload-area {
    border: 2px dashed var(--border-color, #e0e0e0);
    border-radius: var(--radius-lg, 12px);
    padding: 3rem 2rem;
    background: var(--card-secondary, #f8f9fa);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.icp-upload-area:hover,
.icp-upload-area:focus,
.icp-upload-area.dragover {
    border-color: var(--color-2, #3399cc);
    background: rgba(51, 153, 204, 0.06);
}

.icp-upload-area:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(51, 153, 204, 0.2);
}

.icp-upload-icon {
    color: var(--color-2, #3399cc);
    margin-bottom: 1rem;
}

.icp-upload-icon svg {
    width: 60px;
    height: 60px;
}

.icp-upload-area h3 {
    margin: 0 0 0.25rem;
    font-size: 1.3rem;
    color: var(--text-primary, #333);
    font-weight: 600;
}

.icp-upload-area > p {
    margin: 0;
    color: var(--text-secondary, #555);
    font-size: 0.95rem;
}

.icp-file-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1.25rem;
    font-size: 0.82rem;
    color: var(--text-muted, #666);
}

.icp-file-hint svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.icp-divider {
    position: relative;
    margin: 1.5rem 0;
    text-align: center;
}

.icp-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 1px;
    background: var(--border-color, #e0e0e0);
}

.icp-divider span {
    position: relative;
    background: var(--bg-elevated, #fff);
    padding: 0 1rem;
    color: var(--text-muted, #666);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.icp-upload-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ---- Buttons ---- */
.icp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.7rem 1.4rem;
    border: none;
    border-radius: var(--radius-md, 8px);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.icp-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.icp-btn-primary {
    background: var(--color-2, #3399cc);
    color: #fff;
}

.icp-btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(51, 153, 204, 0.35);
}

.icp-btn-secondary {
    background: var(--card-secondary, #f5f5f5);
    color: var(--text-primary, #333);
    border: 1px solid var(--border-color, #e0e0e0);
}

.icp-btn-secondary:hover {
    border-color: var(--color-2, #3399cc);
    color: var(--color-2, #3399cc);
}

.icp-btn-outline {
    background: transparent;
    color: var(--text-secondary, #555);
    border: 1px solid var(--border-color, #e0e0e0);
}

.icp-btn-outline:hover {
    border-color: var(--color-2, #3399cc);
    color: var(--color-2, #3399cc);
    background: rgba(51, 153, 204, 0.06);
}

.icp-btn-danger-outline {
    background: transparent;
    color: var(--color-1, #e64e4e);
    border: 1px solid var(--border-color, #e0e0e0);
}

.icp-btn-danger-outline:hover {
    border-color: var(--color-1, #e64e4e);
    background: rgba(230, 78, 78, 0.06);
}

.icp-btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
}

.icp-btn-sm svg {
    width: 13px;
    height: 13px;
}

.icp-btn-eyedropper {
    background: var(--card-secondary, #f5f5f5);
    color: var(--text-primary, #333);
    border: 1px solid var(--border-color, #e0e0e0);
}

.icp-btn-eyedropper:hover {
    border-color: var(--color-3, #339966);
    color: var(--color-3, #339966);
}

.icp-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ---- Workspace ---- */
.icp-workspace {
    animation: icp-fadeIn 0.3s ease;
    padding: 0 1.75rem 1.75rem;
}

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

/* ---- Image Panel ---- */
.icp-image-panel {
    margin: 1.5rem 0;
}

.icp-image-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.4rem 0;
}

.icp-file-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary, #333);
}

.icp-file-info svg {
    width: 15px;
    height: 15px;
    color: var(--color-2, #3399cc);
}

.icp-dimensions {
    font-size: 0.7rem;
    padding: 0.18rem 0.5rem;
    background: var(--card-secondary, #f8f9fa);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: var(--radius-sm, 4px);
    font-family: 'SF Mono', Monaco, monospace;
    color: var(--text-muted, #666);
}

/* ---- Canvas Container ---- */
.icp-canvas-wrap {
    position: relative;
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    background: var(--card-secondary, #f5f5f5);
    border: 1px solid var(--border-color, #e0e0e0);
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.1));
    cursor: crosshair;
}

.icp-canvas-wrap canvas {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    cursor: crosshair;
}

.icp-cursor {
    position: absolute;
    width: 22px;
    height: 22px;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.2);
    transform: translate(-50%, -50%);
    pointer-events: none;
    display: none;
    z-index: 10;
}

.icp-cursor.keyboard-mode {
    box-shadow: 0 0 0 3px rgba(255,255,0,0.7), 0 0 0 1px rgba(0,0,0,0.3);
}

.icp-btn-close-canvas {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: rgba(0,0,0,0.45);
    border: none;
    border-radius: var(--radius-sm, 4px);
    color: #fff;
    cursor: pointer;
    opacity: 0.8;
    transition: all 0.2s;
    z-index: 5;
}

.icp-btn-close-canvas:hover {
    opacity: 1;
    background: var(--color-1, #e64e4e);
}

.icp-btn-close-canvas svg {
    width: 14px;
    height: 14px;
}

.icp-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.6rem 1rem;
    background: rgba(51, 153, 204, 0.07);
    border-radius: var(--radius-md, 8px);
    color: var(--text-secondary, #555);
    font-size: 0.83rem;
}

.icp-hint svg {
    width: 14px;
    height: 14px;
    color: var(--color-2, #3399cc);
    flex-shrink: 0;
}

/* ---- Controls Bar ---- */
.icp-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.875rem 1rem;
    background: var(--card-secondary, #f8f9fa);
    border-radius: var(--radius-lg, 12px);
    border: 1px solid var(--border-color, #e0e0e0);
}

.icp-controls-left,
.icp-controls-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.icp-controls-right label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary, #555);
}

.icp-controls-right label svg {
    width: 14px;
    height: 14px;
}

.icp-select {
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: var(--radius-sm, 4px);
    background: var(--bg-elevated, #fff);
    color: var(--text-primary, #333);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.icp-select:focus {
    outline: none;
    border-color: var(--color-2, #3399cc);
}

/* ---- Results Grid ---- */
.icp-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

/* ---- Color Panel ---- */
.icp-panel {
    background: var(--card-secondary, #f8f9fa);
    border-radius: var(--radius-lg, 12px);
    border: 1px solid var(--border-color, #e0e0e0);
    padding: 1rem;
    min-height: 180px;
}

.icp-panel-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary, #333);
    margin-bottom: 0.875rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.icp-panel-title svg {
    width: 16px;
    height: 16px;
    color: var(--color-2, #3399cc);
}

.icp-count {
    margin-left: auto;
    padding: 0.1rem 0.55rem;
    background: rgba(51, 153, 204, 0.12);
    color: var(--color-2, #3399cc);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

/* ---- Color Swatches Grid ---- */
.icp-colors {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
    gap: 0.625rem;
    padding: 0.25rem 0;
}

/* ---- Individual Color Swatch ---- */
.icp-swatch {
    position: relative;
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1), 0 0 0 1px var(--border-color, #e0e0e0);
    animation: icp-swatchIn 0.2s ease;
    background: var(--bg-elevated, #fff);
}

.icp-swatch:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.18), 0 0 0 1px var(--border-color, #e0e0e0);
    z-index: 2;
}

.icp-swatch-color {
    width: 100%;
    padding-top: 80%;
    display: block;
}

.icp-swatch-footer {
    padding: 0.3rem 0.35rem;
    text-align: center;
}

.icp-swatch-hex {
    display: block;
    font-size: 0.6rem;
    font-family: 'SF Mono', Monaco, monospace;
    font-weight: 600;
    color: var(--text-secondary, #555);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Copy overlay on hover */
.icp-swatch-overlay {
    position: absolute;
    inset: 0;
    bottom: 30px; /* leave footer visible */
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.18s;
}

.icp-swatch:hover .icp-swatch-overlay {
    opacity: 1;
}

.icp-swatch-overlay svg {
    width: 18px;
    height: 18px;
    color: #fff;
}

.icp-swatch-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    background: rgba(230, 78, 78, 0.85);
    border: none;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.18s;
    padding: 0;
}

.icp-swatch:hover .icp-swatch-remove {
    opacity: 1;
}

.icp-swatch-remove svg {
    width: 10px;
    height: 10px;
}

/* Copied flash */
.icp-swatch.copied .icp-swatch-overlay {
    opacity: 1;
    background: rgba(51, 153, 102, 0.75);
}

@keyframes icp-swatchIn {
    from { opacity: 0; transform: scale(0.75); }
    to   { opacity: 1; transform: scale(1); }
}

/* ---- Empty State ---- */
.icp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    color: var(--text-muted, #999);
    text-align: center;
    gap: 0.5rem;
}

.icp-empty svg {
    width: 32px;
    height: 32px;
    opacity: 0.4;
}

.icp-empty p {
    margin: 0;
    font-size: 0.85rem;
}

/* ---- Export Panel ---- */
.icp-export {
    background: var(--card-secondary, #f8f9fa);
    border-radius: var(--radius-lg, 12px);
    border: 1px solid var(--border-color, #e0e0e0);
    padding: 1.25rem;
}

.icp-export-btns {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.icp-btn-export {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-md, 8px);
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-color, #e0e0e0);
    background: var(--bg-elevated, #fff);
    color: var(--text-primary, #333);
    white-space: nowrap;
}

.icp-btn-export svg {
    width: 14px;
    height: 14px;
}

.icp-btn-export:hover {
    border-color: var(--color-2, #3399cc);
    color: var(--color-2, #3399cc);
    background: rgba(51, 153, 204, 0.06);
}

.icp-btn-export.active {
    background: var(--color-2, #3399cc);
    border-color: var(--color-2, #3399cc);
    color: #fff;
}

.icp-btn-export-png {
    background: var(--color-3, #339966);
    border-color: var(--color-3, #339966);
    color: #fff;
}

.icp-btn-export-png:hover {
    background: #2d8a5a;
    border-color: #2d8a5a;
    color: #fff;
}

.icp-output-wrap {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #e0e0e0);
}

.icp-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.icp-output-header span {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-secondary, #555);
}

.icp-output-code {
    background: var(--bg-elevated, #fff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: var(--radius-md, 8px);
    padding: 1rem;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.8rem;
    color: var(--text-primary, #333);
    overflow-x: auto;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 260px;
    overflow-y: auto;
}

/* ---- Steps List (How to Use) ---- */
.icp-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: icp-step;
}

.icp-steps li {
    position: relative;
    padding-left: 3.2rem;
    padding-bottom: 1.1rem;
    counter-increment: icp-step;
    color: var(--text-secondary, #555);
    line-height: 1.7;
    margin-left: 0.5rem;
}

.icp-steps li:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 0.85rem;
    top: 2rem;
    bottom: 0;
    width: 2px;
    background: rgba(51, 153, 204, 0.15);
}

.icp-steps li:last-child {
    padding-bottom: 0;
}

.icp-steps li::before {
    content: counter(icp-step);
    position: absolute;
    left: -0.1rem;
    top: 0;
    width: 1.9rem;
    height: 1.9rem;
    background: var(--color-2, #3399cc);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
}

.icp-steps li strong {
    color: var(--text-primary, #333);
}

.icp-steps li a {
    color: var(--color-2, #3399cc);
    text-decoration: none;
}

.icp-steps li a:hover {
    text-decoration: underline;
}

/* ---- Features Grid ---- */
.icp-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.icp-feature {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
    min-width: 0;
}

.icp-feature-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md, 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.icp-feature-icon svg {
    width: 22px;
    height: 22px;
}

.icp-feature-icon.blue   { background: var(--color-2, #3399cc); }
.icp-feature-icon.green  { background: var(--color-3, #339966); }
.icp-feature-icon.red    { background: var(--color-1, #e64e4e); }
.icp-feature-icon.purple { background: #7c3aed; }
.icp-feature-icon.orange { background: #d97706; }
.icp-feature-icon.teal   { background: #0891b2; }

.icp-feature-content {
    min-width: 0;
}

.icp-feature-content h3 {
    margin: 0 0 0.3rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary, #333);
}

.icp-feature-content p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary, #555);
    line-height: 1.5;
}

/* ---- Shortcuts Grid ---- */
.icp-shortcuts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.875rem;
}

.icp-shortcut {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.875rem;
    background: var(--card-secondary, #f8f9fa);
    border-radius: var(--radius-md, 8px);
    text-align: center;
    border: 1px solid var(--border-color, #e0e0e0);
}

.icp-shortcut .keys {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.icp-shortcut kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 0.45rem;
    background: var(--bg-elevated, #fff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-bottom-width: 3px;
    border-radius: var(--radius-sm, 4px);
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-primary, #333);
}

.icp-shortcut span {
    font-size: 0.8rem;
    color: var(--text-secondary, #555);
}

/* ---- Use Cases List ---- */
.icp-use-cases {
    list-style: none;
    padding: 0;
    margin: 0.875rem 0;
}

.icp-use-cases li {
    position: relative;
    padding-left: 1.4rem;
    padding-bottom: 0.45rem;
    color: var(--text-secondary, #555);
    font-size: 0.9rem;
}

.icp-use-cases li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 5px;
    height: 5px;
    background: var(--color-2, #3399cc);
    border-radius: 50%;
}

/* ---- Related Links (pill style) ---- */
.icp-related-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
}

.icp-related-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1rem;
    background: var(--card-secondary, #f8f9fa);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 999px;
    color: var(--text-secondary, #555);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.icp-related-link svg {
    width: 15px;
    height: 15px;
}

.icp-related-link:hover {
    background: var(--color-2, #3399cc);
    border-color: var(--color-2, #3399cc);
    color: #fff;
    transform: translateY(-1px);
}

/* ---- Color Detail Tooltip ---- */
.icp-color-detail {
    position: fixed;
    z-index: 9999;
    background: var(--bg-elevated, #fff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: var(--radius-lg, 12px);
    padding: 1rem;
    box-shadow: var(--shadow-xl, 0 20px 40px rgba(0,0,0,0.15));
    min-width: 200px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}

.icp-color-detail.visible {
    opacity: 1;
}

.icp-color-detail-swatch {
    width: 100%;
    height: 60px;
    border-radius: var(--radius-md, 8px);
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color, #e0e0e0);
}

.icp-color-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.2rem 0;
    font-size: 0.8rem;
}

.icp-color-detail-label {
    color: var(--text-muted, #999);
    font-weight: 500;
}

.icp-color-detail-value {
    color: var(--text-primary, #333);
    font-family: 'SF Mono', Monaco, monospace;
    font-weight: 600;
}

.icp-color-name {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color, #e0e0e0);
    font-size: 0.78rem;
    color: var(--text-muted, #999);
    font-style: italic;
    text-align: center;
}

/* ---- Toast ---- */
.icp-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 0.75rem 1.4rem;
    background: var(--text-primary, #333);
    color: #fff;
    border-radius: var(--radius-md, 8px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-xl, 0 20px 40px rgba(0,0,0,0.2));
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10001;
    white-space: nowrap;
    max-width: 90vw;
}

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

.icp-toast svg {
    width: 18px;
    height: 18px;
    color: var(--color-3, #339966);
    flex-shrink: 0;
}

.icp-toast.toast-error svg {
    color: var(--color-1, #e64e4e);
}

/* ---- Magnifier ---- */
.icp-magnifier {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.9), var(--shadow-xl, 0 20px 40px rgba(0,0,0,0.2));
}

.icp-magnifier canvas {
    display: block;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.icp-magnifier-info {
    padding: 0.35rem 0.5rem;
    background: rgba(0,0,0,0.88);
    color: #fff;
    font-size: 0.68rem;
    text-align: center;
    font-family: 'SF Mono', Monaco, monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

/* ---- Error message ---- */
.icp-error-msg {
    padding: 0.875rem 1.25rem;
    background: rgba(230, 78, 78, 0.08);
    border-radius: var(--radius-md, 8px);
    border: 1px solid rgba(230, 78, 78, 0.2);
    color: var(--color-1, #e64e4e);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.icp-error-msg svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.icp-error-msg a {
    color: var(--color-1, #e64e4e);
    font-weight: 600;
}

/* ---- Info Card Overrides (reset custom_styles.css) ---- */
/* Per project guidelines: info-cards should have no bg, shadow, or border */
.tool-container .info-card {
    box-shadow: none !important;
    border: none !important;
    margin-top: 2rem !important;
    margin-bottom: 0 !important;
}

.tool-container .info-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #333);
    margin: 0 0 1.25rem;
    padding-bottom: 0.75rem;
}

.tool-container .info-card h2 svg,
.tool-container .info-card h2 i {
    color: var(--color-2, #3399cc);
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.tool-container .info-card p {
    color: var(--text-secondary, #555);
    line-height: 1.7;
    margin: 0 0 0.75rem;
}

.tool-container .info-card a {
    color: var(--color-2, #3399cc);
    text-decoration: none;
}

.tool-container .info-card a:hover {
    text-decoration: underline;
}

[data-theme="dark"] .tool-container .info-card h2 {
    color: var(--text-primary, #f1f5f9);
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .tool-container .info-card p {
    color: #94a3b8;
}

/* ---- Dark Mode Overrides ---- */
[data-theme="dark"] .icp-title,
[data-theme="dark"] .icp-title-row svg {
    color: #60b8e0;
}

[data-theme="dark"] .icp-tool-main {
    background: #1e293b;
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .icp-upload-area {
    background: #0f172a;
    border-color: rgba(255,255,255,0.15);
}

[data-theme="dark"] .icp-upload-area:hover,
[data-theme="dark"] .icp-upload-area.dragover {
    background: rgba(96, 184, 224, 0.08);
}

[data-theme="dark"] .icp-divider span {
    background: #1e293b;
}

[data-theme="dark"] .icp-canvas-wrap {
    background: #0f172a;
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .icp-controls {
    background: #0f172a;
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .icp-panel {
    background: #0f172a;
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .icp-panel-title {
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .icp-swatch {
    border-color: rgba(255,255,255,0.1);
    background: #1e293b;
}

[data-theme="dark"] .icp-swatch-hex {
    color: #94a3b8;
}

[data-theme="dark"] .icp-export {
    background: #0f172a;
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .icp-output-wrap {
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .icp-output-code {
    background: #1e293b;
    border-color: rgba(255,255,255,0.1);
    color: #f1f5f9;
}

[data-theme="dark"] .icp-btn-secondary,
[data-theme="dark"] .icp-btn-outline,
[data-theme="dark"] .icp-btn-eyedropper {
    background: #1e293b;
    border-color: rgba(255,255,255,0.15);
    color: #f1f5f9;
}

[data-theme="dark"] .icp-btn-export {
    background: #1e293b;
    border-color: rgba(255,255,255,0.15);
    color: #f1f5f9;
}

[data-theme="dark"] .icp-btn-export:hover {
    background: rgba(96, 184, 224, 0.15);
    border-color: #60b8e0;
    color: #60b8e0;
}

[data-theme="dark"] .icp-btn-export.active {
    background: #60b8e0;
    border-color: #60b8e0;
    color: #0f172a;
}

[data-theme="dark"] .icp-select {
    background: #1e293b;
    border-color: rgba(255,255,255,0.15);
    color: #f1f5f9;
}

[data-theme="dark"] .icp-shortcut {
    background: #0f172a;
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .icp-shortcut kbd {
    background: #1e293b;
    border-color: rgba(255,255,255,0.15);
    color: #f1f5f9;
}

[data-theme="dark"] .icp-related-link {
    background: #1e293b;
    border-color: rgba(255,255,255,0.1);
    color: #cbd5e1;
}

[data-theme="dark"] .icp-hint {
    background: rgba(96, 184, 224, 0.08);
}

[data-theme="dark"] .icp-color-detail {
    background: #1e293b;
    border-color: rgba(255,255,255,0.15);
}

[data-theme="dark"] .icp-color-detail-row {
    border-color: rgba(255,255,255,0.08);
}

[data-theme="dark"] .icp-color-detail-value {
    color: #f1f5f9;
}

[data-theme="dark"] .icp-color-name {
    border-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .icp-toast {
    background: #334155;
    border: 1px solid rgba(255,255,255,0.1);
}

[data-theme="dark"] .icp-magnifier {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.2), 0 20px 40px rgba(0,0,0,0.5);
}

[data-theme="dark"] .icp-error-msg {
    background: rgba(230, 78, 78, 0.1);
    border-color: rgba(230, 78, 78, 0.3);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .icp-features {
        grid-template-columns: 1fr;
    }
    .icp-shortcuts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .icp-upload {
        padding: 1.5rem 1rem;
    }
    .icp-workspace {
        padding: 0 1rem 1rem;
    }
    .icp-results {
        grid-template-columns: 1fr;
    }
    .icp-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .icp-controls-left,
    .icp-controls-right {
        justify-content: center;
    }
    .icp-export-btns {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .icp-title {
        font-size: 1.7rem;
    }
    .icp-title-row {
        flex-direction: column;
        gap: 0.4rem;
    }
    .icp-upload-area {
        padding: 2rem 1rem;
    }
    .icp-colors {
        grid-template-columns: repeat(4, 1fr);
    }
    .icp-feature {
        flex-direction: column;
    }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
