/* ============================================
   Color Palette Generator Styles
   Dark premium aesthetic, vivid swatches.
============================================ */

:root {
    --bg: #0f0f1a;
    --surface: #1a1a2e;
    --surface2: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.08);
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --accent: #6366f1;
    --radius: 14px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    background-image: radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(168, 85, 247, 0.1) 0%, transparent 50%);
}

/* --- Nav --- */
.tool-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.back-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--text);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent);
}

/* --- Container & Header --- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

.tool-header {
    text-align: center;
    margin-bottom: 3rem;
}

.header-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #f1f5f9, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tool-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 580px;
    margin: 0 auto;
    line-height: 1.6;
}

/* --- Picker Row --- */
.picker-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 2.5rem;
}

.picker-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
}

.color-input-wrapper input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    background: transparent;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.color-input-wrapper input[type="text"] {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1rem;
    font-family: monospace;
    font-weight: 600;
    width: 90px;
}

.color-input-wrapper input[type="text"]:focus {
    outline: none;
}

.color-input-wrapper.small input[type="color"] {
    width: 28px;
    height: 28px;
}

.color-input-wrapper.small input[type="text"] {
    width: 75px;
    font-size: 0.9rem;
}

/* Harmony Tabs */
.harmony-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1;
}

.tab {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.2);
}

.tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* --- Section Labels --- */
.palette-section {
    margin-bottom: 2.5rem;
}

.section-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.section-label span {
    color: var(--accent);
    text-transform: none;
    letter-spacing: 0;
    font-size: 1rem;
}

/* --- Palette Grid --- */
.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.swatch-card {
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.swatch-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

.swatch-color {
    height: 120px;
    display: flex;
    align-items: flex-end;
    padding: 0.5rem;
}

.swatch-copy-btn {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    border: none;
    border-radius: 6px;
    color: white;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

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

.swatch-info {
    background: var(--surface);
    padding: 0.75rem;
}

.swatch-hex {
    font-family: monospace;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.swatch-name {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- Shades Grid --- */
.shades-grid {
    display: flex;
    gap: 0.5rem;
    border-radius: var(--radius);
    overflow: hidden;
    height: 80px;
}

.shade-swatch {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.5rem;
    cursor: pointer;
    position: relative;
    transition: flex 0.2s;
}

.shade-swatch:hover {
    flex: 1.5;
}

.shade-label {
    font-size: 0.65rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
}

.shade-swatch:hover .shade-label {
    opacity: 1;
}

/* --- Contrast Section --- */
.contrast-section {
    margin-bottom: 3rem;
}

.contrast-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}

.contrast-inputs {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.contrast-color-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.contrast-preview {
    flex: 1;
    min-height: 80px;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-text {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1rem 2rem;
    border-radius: 8px;
    display: block;
    width: 100%;
    text-align: center;
}

/* Contrast Results */
.contrast-results {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.contrast-badge {
    flex: 1;
    min-width: 160px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.contrast-ratio {
    font-size: 2rem;
    font-weight: 700;
    font-family: monospace;
    margin-bottom: 0.25rem;
}

.contrast-level {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.wcag-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    padding: 0.35rem 0;
    border-top: 1px solid var(--border);
}

.wcag-tag {
    font-family: monospace;
    font-weight: 600;
}

.wcag-status {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.75rem;
}

.wcag-pass {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.wcag-fail {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #10b981;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
    transform: translateY(150%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
}

.toast.show {
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .picker-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .harmony-tabs {
        width: 100%;
    }

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

    .shades-grid {
        height: 60px;
    }

    .contrast-inputs {
        flex-direction: column;
    }

    .contrast-preview {
        width: 100%;
    }
}