/* Base Styles */
:root {
    --primary-color: #4C40FD;
    --primary-color-dark: #3A30C7;
    --text-color: #333;
    --bg-color: #f5f5f5;
    --border-color: #ddd;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --header-bg: #fff;
    --section-bg: #fff;
    --input-bg: #fff;
    --button-bg: #fff;
    --button-hover: #f0f0f0;
}

[data-theme="dark"] {
    --primary-color: #4C40FD;
    --primary-color-dark: #3A30C7;
    --text-color: #fff;
    --bg-color: #1a1a1a;
    --border-color: #404040;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --header-bg: #2d2d2d;
    --section-bg: #2d2d2d;
    --input-bg: #333;
    --button-bg: #333;
    --button-hover: #444;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--bg-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    background: var(--header-bg);
    border-color: var(--border-color);
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

header p {
    font-size: 1.1rem;
    color: #4b5563;
}

/* Main Content */
main {
    flex: 1;
    padding: 1rem 0;
}

/* Sections */
section {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px var(--shadow-color);
    padding: 2rem;
    margin-bottom: 2rem;
}

section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

/* Color Picker */
.color-picker {
    background: var(--section-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.color-picker h2,
.color-picker h3,
.color-picker h4 {
    color: var(--text-color);
    margin-bottom: 1rem;
}

.color-picker-container {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

.color-picker-main {
    width: 400px;
    height: 400px;
    position: relative;
}

#color-picker-canvas {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    cursor: crosshair;
}

#color-picker-cursor {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 0 0 1px black;
    display: none;
}

.color-picker-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.color-input-group {
    display: flex;
    gap: 0.5rem;
}

#color-input {
    flex: 1;
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--section-bg);
    color: var(--text-color);
    transition: border-color 0.2s ease;
}

#color-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

#color-input::placeholder {
    color: var(--text-color);
    opacity: 0.7;
}

#apply-color {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#apply-color:hover {
    background: var(--primary-color-dark);
}

.slider-container {
    width: 100%;
}

#hue-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    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%)
    );
    border-radius: 4px;
    outline: none;
}

#hue-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.selected-color {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

#selected-color-preview {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: #fff !important;
    color-scheme: light !important;
    forced-color-adjust: none !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    isolation: isolate !important;
}

.color-values {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.color-value-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.color-value-group label {
    font-size: 0.875rem;
    color: var(--text-color);
    opacity: 0.8;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group input {
    flex: 1;
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    background: var(--section-bg);
    color: var(--text-color);
}

.copy-btn {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s ease;
}

.copy-btn:hover {
    background: var(--primary-color-dark);
}

.color-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.color-actions button {
    flex: 1;
    min-width: 120px;
    padding: 0.75rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.color-actions button:hover {
    background: var(--primary-color-dark);
}

.saved-colors {
    margin-top: 2rem;
}

#saved-colors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.saved-color {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.saved-color:hover {
    transform: scale(1.05);
}

.saved-color .remove-color {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: var(--button-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.saved-color:hover .remove-color {
    opacity: 1;
}

.palette-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 1rem;
}

.palette-group h4 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.palette-colors {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.palette-color {
    flex: 1;
    min-width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid var(--border-color);
    position: relative;
}

.palette-color:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.palette-color::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 6px;
}

.palette-color:hover::after {
    opacity: 1;
}

/* Dark Mode Specific Styles */
[data-theme="dark"] .palette-color {
    border-color: #444;
}

[data-theme="dark"] #color-picker-cursor {
    border-color: #fff;
    box-shadow: 0 0 0 1px #444;
}

[data-theme="dark"] #hue-slider::-webkit-slider-thumb {
    background: #fff;
    border-color: #444;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    color: #6b7280;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .color-picker-container {
        flex-direction: column;
    }

    .color-picker-main {
        width: 100%;
        height: 300px;
    }

    .selected-color {
        flex-direction: column;
    }

    #selected-color-preview {
        width: 100%;
        height: 40px;
    }

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

/* Copy Notification */
.copy-notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    animation: fadeInOut 1.5s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(1rem); }
    20% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-1rem); }
}

/* Logo Styles */
.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0rem;
}

.logo img {
    height: 90px;
    width: auto;
}

/* Language Switcher */
.language-switcher {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    gap: 0.5rem;
    background: var(--header-bg);
    padding: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.language-switcher button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--button-bg);
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.language-switcher button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Theme Switcher */
.theme-switcher {
    margin-left: auto;
}

.theme-switcher button {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.theme-switcher button:hover {
    background-color: var(--hover-color);
}

/* Floating Logo */
.floating-logo {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1000;
    background: var(--section-bg);
    padding: 0.8rem;
    border-radius: 30%;
    box-shadow: 0 2px 10px var(--shadow-color);
    transition: transform 0.3s ease;
}

.floating-logo:hover {
    transform: scale(1.1);
}

.floating-logo img {
    width: 80px;
    height: 50px;
    border-radius: 30%;
}

/* Footer Link */
footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--text-color);
}

/* Update other elements for dark mode */
input, select, button {
    background: var(--input-bg);
    color: var(--text-color);
    border-color: var(--border-color);
}

.tool-section {
    background: var(--section-bg);
    border-color: var(--border-color);
}

.description {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-color);
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.theme-toggle {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--button-bg);
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: var(--button-hover);
}

[data-theme="dark"] .theme-toggle i {
    color: #FFD700;
}

/* Responsive Design */
@media (max-width: 768px) {
    .language-switcher {
        top: auto;
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        justify-content: center;
        background: var(--header-bg);
        padding: 0.5rem;
        border-radius: 8px;
        box-shadow: 0 2px 8px var(--shadow-color);
    }

    .language-switcher button {
        flex: 1;
        max-width: 80px;
    }
}
