:root {
    --primary: #2c3e50;
    --accent: #e74c3c;
    --accent-hover: #c0392b;
    --secondary: #3498db;
    --success: #27ae60;
    --success-hover: #219e50;
    --gray: #95a5a6;
    --light-gray: #ecf0f1;
    --text: #2c3e50;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --container-bg: white;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    --border-radius: 18px;
    --transition: all 0.3s ease;
}

body.dark-mode {
    --primary: #ecf0f1;
    --text: #ecf0f1;
    --success: #27ae60;
    --container-bg: #1E123C;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    --bg-gradient: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
}

.color-generator-container {
    max-width: 100%;
    margin: auto;
    background: var(--container-bg);
    border-radius: 0;
    padding: 50px 30px;
    overflow: hidden;
    position: relative;
    transition: background 0.5s;
}

.theme-toggle {
    position: absolute;
    top: 5px;
    right: 35px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    z-index: 10;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 10px 16px;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

body.dark-mode .theme-toggle {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

.theme-toggle .sun {
    opacity: 1;
}

.theme-toggle .moon {
    opacity: 0.25;
}

body.dark-mode .theme-toggle .sun {
    opacity: 0.25;
}

body.dark-mode .theme-toggle .moon {
    opacity: 1;
}

.random-color-generator-title-suite {
    color: #e74c3ce6 !important;
}

.random-color-generator-title {
    color: #ffffff !important;
}

.tool-wrapper {
    width: 100%;
    max-width: 82rem;
    margin-left: auto;
    margin-right: auto;
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 2rem;
    align-items: start;
    padding-bottom: 30px;
}

@media (min-width: 1024px) {
    .tool-wrapper {
        grid-template-columns: repeat(12, minmax(0, 1fr));
    }
}

.controls {
    color: var(--text);
    border-radius: 1.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    padding: 2rem;
    border: 1px solid #e5e7eb;
    background: var(--container-bg);
}

@media (min-width: 1024px) {
    .controls {
        grid-column: span 5 / span 5;
    }
}

body.dark-mode .controls {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Enhanced Color Display */
.color-display {
    width: 100%;
    height: 320px;
    border-radius: 20px;
    margin-bottom: 25px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    background-color: #667eea; 
}

.color-display:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.color-display::after {
    content: 'Click to generate';
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    padding: 12px 24px;
    border-radius: 30px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
}

.color-display:hover::after {
    opacity: 1;
}

/* Professional Color Palette */
.color-palette {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 15px;
}

body.dark-mode .color-palette {
    background: rgba(255, 255, 255, 0.03);
}

.palette-color {
    aspect-ratio: 1;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.palette-color::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.palette-color::after {
    content: attr(title);
    position: absolute;
    bottom: -22px;
    left: 0;
    right: 0;
    font-size: 10px;
    color: var(--text);
    opacity: 0.7;
    text-align: center;
    white-space: nowrap;
    line-height: 1.2;
}

.palette-color:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.palette-color:hover::before {
    opacity: 1;
}

/* Interactive Slider Section */
.color-slider-section {
    margin-bottom: 30px;
    padding: 25px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 15px;
}

body.dark-mode .color-slider-section {
    background: rgba(255, 255, 255, 0.03);
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.slider-value {
    background: var(--accent);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    min-width: 45px;
    text-align: center;
}

.slider-container {
    position: relative;
    margin-bottom: 20px;
}

.color-slider {
    width: 100%;
    height: 8px;
    border-radius: 10px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
    background: linear-gradient(to right, #000, #fff);
}

.color-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 3px solid var(--accent);
    transition: all 0.2s;
}

.color-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.color-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 3px solid var(--accent);
    transition: all 0.2s;
}

#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%)
    );
}

/* Saturation & Lightness backgrounds are updated dynamically via JS */

/* Color Codes */
.color-codes {
    display: grid;
    gap: 12px;
    margin-bottom: 25px;
}

.color-code-item {
    background: #f8f9fa;
    padding: 18px 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
    border: 2px solid transparent;
}

body.dark-mode .color-code-item {
    background: rgba(255, 255, 255, 0.05);
}

.color-code-item:hover {
    background: #e9ecef;
    transform: translateX(3px);
    border-color: var(--accent);
}

body.dark-mode .color-code-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.code-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.code-label {
    font-size: 12px;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-value {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    color: var(--text);
}

.copy-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.copy-btn.copied {
    background: linear-gradient(135deg, #27ae60 0%, #219e50 100%);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.generate-btn {
    flex: 1;
    padding: 18px;
    background: linear-gradient(135deg, #27ae60 0%, #219e50 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 20px rgba(39, 174, 96, 0.3);
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(39, 174, 96, 0.4);
}

.generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.generate-btn.generating {
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.98); }
}

.lock-btn {
    padding: 18px 24px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.lock-btn:hover {
    background: #5a6268;
}

.lock-btn.locked {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.lock-btn.locked:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
}

.lock-message {
    text-align: center;
    color: #6c757d;
    font-size: 14px;
    margin-top: 10px;
    padding: 12px;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 8px;
    font-weight: 600;
}

/* Color History */
.color-history {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid rgba(0, 0, 0, 0.1);
}

body.dark-mode .color-history {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.color-history h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--text) !important;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.history-item {
    cursor: pointer;
    transition: all 0.3s;
}

.history-item:hover {
    transform: translateY(-5px);
}

.history-color {
    width: 100%;
    height: 70px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    margin-bottom: 8px;
    transition: all 0.3s;
}

.history-item:hover .history-color {
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.history-hex {
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: var(--text);
    font-weight: 600;
}

.clear-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.clear-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Info Display Container */
.info-display-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

@media (min-width: 1024px) {
    .info-display-container {
        grid-column: span 7 / span 7;
    }
}

/* Steps Grid */
.steps-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: var(--container-bg);
    border-radius: 14px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    text-align: left;
    border: 1px solid #e5e7eb;
}

body.dark-mode .step {
    border-color: rgba(255, 255, 255, 0.1);
}

.step:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #d70932;
    color: white;
    font-weight: bold;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.step p {
    margin: 0;
    font-size: 13px;
    color: var(--text);
}

.steps-grid-mobile {
    display: none;
}

/* Info Section */
.info-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.info-card {
    background: var(--container-bg);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

body.dark-mode .info-card {
    border-color: rgba(255, 255, 255, 0.1);
}

.info-card h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text) !important;
}

.info-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-card li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: var(--text);
    line-height: 1.6;
}

.info-card li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

.formula-info {
    padding: 10px 0;
    color: var(--text);
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

body.dark-mode .formula-info {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.formula-info:last-child {
    border-bottom: none;
}

.formula-info strong {
    color: var(--accent);
    margin-right: 8px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .color-generator-container {
        padding: 50px 0;
    }

    .controls {
        margin-top: 0;
        border: none !important;
        box-shadow: none !important;
    }

    .tool-wrapper {
        width: 95%;
        gap: 0 !important;
    }

    .color-display {
        height: 220px;
    }

    .color-palette {
        grid-template-columns: repeat(3, 1fr);
    }

    .action-buttons {
        flex-direction: row;
    }

    .lock-btn {
        padding: 18px 20px;
    }

    .lock-btn span {
        display: none;
    }

    .steps-grid {
        display: none;
    }

    .steps-grid-mobile {
        display: block !important;
        padding-bottom: 50px;
    }

    .steps-grid-mobile .step {
        margin-bottom: 16px;
    }

    .info-section {
        padding: 0 10px;
    }

    .history-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .code-value {
        font-size: 14px;
    }

    .copy-btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    .generate-btn {
        font-size: 14px;
        padding: 16px;
    }
}