/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color variables matching tools-hash style */
    --bg-surface: #f5f7fb;
    --bg-card: rgba(255, 255, 255, 0.92);
    --bg-card-light: rgba(255, 255, 255, 0.8);
    --border-color: rgba(15, 23, 42, 0.08);
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --accent-blue: #2563eb;
    --accent-blue-strong: #1d4ed8;
    --accent-teal: #0ea5e9;
    --accent-purple: #6366f1;
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.08);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2.25rem;
    --spacing-xl: 3rem;
    --max-width: 1100px;

    /* Color-specific variables */
    --primary-red: #ef4444;
    --primary-green: #10b981;
    --primary-yellow: #f59e0b;

    /* Gray scale variables */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --white: #ffffff;
    --radius-full: 9999px;

    /* Additional variables */
    --primary-blue: var(--accent-blue);
    --shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 18px 45px rgba(15, 23, 42, 0.08);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-surface);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: var(--spacing-lg) var(--spacing-sm);
    position: relative;
    overflow-x: hidden;
    line-height: 1.6;
}

.gradient-background {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 15% 20%, rgba(239, 68, 68, 0.15) 0, transparent 42%),
                radial-gradient(circle at 85% 25%, rgba(14, 165, 233, 0.15) 0, transparent 48%),
                radial-gradient(circle at 50% 75%, rgba(99, 102, 241, 0.15) 0, transparent 55%),
                radial-gradient(circle at 25% 85%, rgba(245, 158, 11, 0.12) 0, transparent 45%),
                linear-gradient(160deg, #ffffff 0%, #f8fafc 100%);
    z-index: 0;
    pointer-events: none;
}

/* ==========================================
   App Shell Layout
   ========================================== */
.app-shell {
    width: 100%;
    max-width: var(--max-width);
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* ==========================================
   Header
   ========================================== */
.header {
    text-align: center;
    padding-bottom: var(--spacing-sm);
}

.title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.title-icon {
    width: 52px;
    height: 52px;
    filter: drop-shadow(0 10px 24px rgba(37, 99, 235, 0.3));
}

.subtitle {
    margin-top: var(--spacing-xs);
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.7;
}

/* ==========================================
   Content Grid Layout
   ========================================== */
.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.3fr) minmax(0, 0.7fr);
    gap: var(--spacing-lg);
}

/* ==========================================
   Panels
   ========================================== */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}



.section-title {
    font-size: 1.35rem;
    letter-spacing: 0.01em;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

/* ==========================================
   Input Section
   ========================================== */
.input-group {
    margin-bottom: var(--spacing-md);
}

.input-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.label-text {
    flex: 1;
}

.btn-clear {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.btn-clear:hover {
    color: var(--primary-red);
    background: rgba(239, 68, 68, 0.1);
}

.color-input {
    width: 100%;
    padding: 1.05rem 1.25rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.25s ease;
    font-family: inherit;
    background: #ffffff;
    color: var(--text-primary);
    line-height: 1.6;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.color-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 0.22rem rgba(37, 99, 235, 0.12);
}

.color-input::placeholder {
    color: var(--text-secondary);
}

/* Input panel with color border */
.input-panel {
    position: relative;
    border: 3px solid transparent;
    border-radius: var(--radius-lg);
    transition: border-color 0.3s ease;
}

.input-panel.has-color {
    border-color: var(--input-color, var(--border-color));
}

.input-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.85rem 1.6rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-blue-strong) 100%);
    color: #ffffff;
    box-shadow: 0 12px 25px rgba(37, 99, 235, 0.18);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(96, 165, 250, 0.25);
}

.btn-secondary {
    background: rgba(37, 99, 235, 0.06);
    color: var(--accent-blue);
    border: 1px solid rgba(37, 99, 235, 0.18);
}

.btn-secondary:hover {
    border-color: rgba(37, 99, 235, 0.35);
    background: rgba(37, 99, 235, 0.12);
    color: var(--accent-blue-strong);
}

.btn-icon {
    font-size: 1.25rem;
}

/* ==========================================
   Results Section
   ========================================== */
.results-section {
    animation: fadeIn 0.5s ease-out;
}

.no-results {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem 1rem;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.format-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.format-item {
    background: var(--bg-card-light);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: var(--radius-md);
    padding: 0.8rem;
    transition: all 0.3s ease;
    position: relative;
}

.format-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.format-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.format-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.copy-btn {
    background: transparent;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.2rem;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

.copy-btn:hover {
    color: var(--primary-blue);
    background: var(--gray-100);
}

.format-value {
    font-family: 'JetBrains Mono', 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-size: 0.8rem;
    color: var(--text-primary);
    line-height: 1.3;
    word-break: break-all;
    padding-right: 1.5rem;
    font-weight: 500;
}

/* ==========================================
   Color Tools Section
   ========================================== */
.tools-section {
    margin-bottom: var(--spacing-lg);
}

.tools-layout {
    display: flex;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.tools-column {
    flex: 0 0 280px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.tools-results {
    flex: 1;
    background: var(--bg-card-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
}

.results-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.current-color-preview {
    width: 100%;
    height: 60px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    margin-bottom: var(--spacing-sm);
    transition: all 0.3s ease;
}

.current-color-value {
    font-family: 'JetBrains Mono', 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.tool-item {
    background: var(--bg-card-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem;
}

.tool-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.label-text {
    font-weight: 500;
    color: var(--text-primary);
}

.slider-control {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    width: 100%;
}

.color-slider {
    flex: 1;
    height: 4px;
    border-radius: var(--radius-full);
    outline: none;
    border: none;
    background: var(--border-color);
    cursor: pointer;
}

/* Specific slider backgrounds */
#hueSlider {
    background: linear-gradient(to right,
        hsl(0, 100%, 50%),
        hsl(60, 100%, 50%),
        hsl(120, 100%, 50%),
        hsl(180, 100%, 50%),
        hsl(240, 100%, 50%),
        hsl(300, 100%, 50%),
        hsl(360, 100%, 50%));
}

#saturationSlider {
    background: linear-gradient(to right, #808080, #ff0000);
}

#lightnessSlider {
    background: linear-gradient(to right, #000000, #808080, #ffffff);
}

#alphaSlider {
    background: linear-gradient(to right,
        rgba(128, 128, 128, 0),
        rgba(128, 128, 128, 1));
}

.color-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    border: 2px solid #ffffff;
}

.color-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-soft);
}

.color-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    border: 2px solid #ffffff;
}

.color-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-soft);
}

.slider-value {
    min-width: 40px;
    text-align: right;
    font-family: 'JetBrains Mono', 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8rem;
}

/* ==========================================
   Color Variations
   ========================================== */
.color-variations {
    margin-top: var(--spacing-lg);
}

.variation-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.variation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--spacing-md);
}

.variation-item {
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.variation-item:hover {
    transform: scale(1.05);
}

.variation-color {
    width: 100%;
    height: 60px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    margin-bottom: var(--spacing-xs);
    transition: all 0.3s ease;
    position: relative;
}

.variation-color:hover {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-sm);
}

.variation-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==========================================
   Palette Section
   ========================================== */
.palette-section {
    margin-bottom: var(--spacing-lg);
}

.palette-presets {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.preset-group {
    background: var(--bg-card-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

.preset-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.preset-colors {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.preset-color {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.preset-color:hover {
    transform: scale(1.1);
    border-color: var(--accent-blue);
}

.preset-color:active {
    transform: scale(0.95);
}

/* ==========================================
   Links Section
   ========================================== */
.links-section {
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm) 0;
    border-top: 1px solid var(--border-color);
}

.links-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.links-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.links-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.link-item {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
    padding: 0.25rem 0.5rem;
}

.link-item:hover {
    color: var(--accent-blue);
}

/* ==========================================
   Footer
   ========================================== */
.footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: var(--spacing-sm) 0;
}

/* ==========================================
   Toast
   ========================================== */
.success-toast {
    position: fixed;
    top: 22px;
    right: 22px;
    background: rgba(37, 99, 235, 0.9);
    color: #ffffff;
    padding: 0.85rem 1.4rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 12px 32px rgba(37, 99, 235, 0.18);
    animation: slideIn 0.3s ease, fadeOut 0.4s ease 2.6s forwards;
    z-index: 1000;
}

.success-toast.warning {
    background: rgba(245, 158, 11, 0.9);
}

.success-toast.error {
    background: rgba(239, 68, 68, 0.9);
}

/* ==========================================
   Animations
   ========================================== */
@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==========================================
   Responsive Design
   ========================================== */
@media (max-width: 1100px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .results-panel {
        order: -1;
    }
}

@media (max-width: 768px) {
    body {
        padding: var(--spacing-md) var(--spacing-xs);
    }

    .panel {
        padding: var(--spacing-md);
        border-radius: var(--radius-md);
    }

    .title {
        font-size: 2.2rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-xs);
    }

    .title-icon {
        width: 42px;
        height: 42px;
        margin-bottom: var(--spacing-xs);
    }

    .subtitle {
        font-size: 1rem;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .tools-layout {
        flex-direction: column;
    }

    .tools-column {
        flex: 1;
        width: 100%;
    }

    .tools-results {
        flex: 1;
        order: -1;
    }

    .input-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .format-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 520px) {
    .content-grid {
        gap: var(--spacing-md);
    }

    .title {
        font-size: 1.8rem;
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-xs);
    }

    .title-icon {
        width: 36px;
        height: 36px;
        margin-bottom: var(--spacing-xs);
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .preset-color {
        width: 35px;
        height: 35px;
    }

    .links-container {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        text-align: center;
    }

    .links-list {
        justify-content: center;
        text-align: center;
    }
}

/* ==========================================
   Utility Classes
   ========================================== */
.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}