/* Base Styles */
:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --text-color: #333;
    --bg-color: #f9f9f9;
    --card-bg: #fff;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: var(--transition);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
header {
     margin: auto;
    background-color: var(--card-bg);
    box-shadow: var(--shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
}

.header-controls {
    display: flex;
    gap: 1rem;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: var(--transition);
}

button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

#theme-toggle svg {
    fill: var(--text-color);
    width: 24px;
    height: 24px;
}

#help-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Content Layout */
.color-picker-container {
      /* display: grid; */
    grid-template-columns: 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.color-selection {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.color-display {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.color-preview {
    width: 100%;
    height: 150px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.color-values {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.color-format {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-input input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: monospace;
}

#copy-btn {
    padding: 0.5rem;
    border-radius: var(--radius);
    background-color: var(--primary-color);
    color: white;
}

#copy-btn:hover {
    background-color: #2980b9;
}

.color-controls {
    display: flex;
    gap: 2rem;
}

.color-wheel-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

#color-wheel {
    border-radius: 50%;
    box-shadow: var(--shadow);
}

.color-wheel-selector {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid white;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
    transform: translate(-6px, -6px);
}

.sliders {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.slider-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.slider-group label {
    width: 80px;
    font-size: 0.9rem;
}

.slider-group input[type="range"] {
    flex: 1;
}

.slider-group span {
    width: 50px;
    text-align: right;
    font-family: monospace;
    font-size: 0.9rem;
}

/* Color Tools */
.color-tools {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.tool-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.5rem 1rem;
    background-color: transparent;
    border: none;
    border-radius: var(--radius) var(--radius) 0 0;
}

.tab-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.tab-panel {
    display: none;
    padding: 1rem 0;
}

.tab-panel.active {
    display: block;
}

/* Color Harmonies */
.harmony-group {
    margin-bottom: 1.5rem;
}

.harmony-group h3 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: var(--text-color);
}

.harmony-colors {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.harmony-color {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    box-shadow: var(--shadow);
}

.harmony-color:hover {
    transform: scale(1.1);
}

.harmony-color::after {
    content: attr(data-code);
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    white-space: nowrap;
    display: none;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.harmony-color:hover::after {
    display: block;
}

/* Preview Section */
.preview-options {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.preview-options label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
}

.preview-display {
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border-radius: var(--radius);
    background-color: white;
    box-shadow: var(--shadow);
}

.preview-box {
    width: 100px;
    height: 100px;
    border-radius: var(--radius);
}

.preview-text {
    padding: 1rem;
    border-radius: var(--radius);
}

.preview-button button {
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 1rem;
}

.preview-gradient {
    width: 100%;
    height: 100px;
    border-radius: var(--radius);
}

/* Accessibility Checker */
.contrast-checker {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contrast-ratio {
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.contrast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.contrast-pair {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    border-radius: var(--radius);
    background-color: var(--card-bg);
}

.contrast-color {
    width: 50px;
    height: 50px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: var(--shadow);
}

.contrast-result {
    flex: 1;
    font-family: monospace;
}

.accessibility-info {
    margin-top: 1rem;
    padding: 1rem;
    background-color: rgba(52, 152, 219, 0.1);
    border-radius: var(--radius);
}

.accessibility-info ul {
    margin-top: 0.5rem;
    padding-left: 1.5rem;
}

.accessibility-info li {
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

/* Image Picker */
.image-picker-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.image-upload {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.image-upload input[type="file"] {
    display: none;
}

.image-upload label, #sample-images-btn {
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.image-upload label:hover, #sample-images-btn:hover {
    background-color: #2980b9;
}

.image-display {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    max-height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #eee;
}

#image-canvas {
    max-width: 100%;
    max-height: 300px;
    display: block;
}

.eyedropper-cursor {
    position: absolute;
    pointer-events: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
}

.picked-colors-grid {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.picked-color {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow);
}

.picked-color::after {
    content: attr(data-code);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    white-space: nowrap;
    display: none;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.picked-color:hover::after {
    display: block;
}

/* Color History */
.color-history {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
}

.history-section, .saved-section {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.color-history-grid, .saved-colors-grid {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.history-color, .saved-color {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow);
}

.history-color::after, .saved-color::after {
    content: attr(data-code);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    white-space: nowrap;
    display: none;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.history-color:hover::after, .saved-color:hover::after {
    display: block;
}

#save-current-color {
    background-color: var(--secondary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
}

#save-current-color:hover {
    background-color: #27ae60;
}

/* Utility Actions */
.utility-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 2rem 0;
}

.utility-actions button {
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--radius);
}

.utility-actions button:hover {
    background-color: #2980b9;
}

#random-color {
    background-color: #9b59b6;
}

#random-color:hover {
    background-color: #8e44ad;
}

#export-css {
    background-color: #e67e22;
}

#export-css:hover {
    background-color: #d35400;
}

#export-image {
    background-color: #1abc9c;
}

#export-image:hover {
    background-color: #16a085;
}

#clear-history {
    background-color: #e74c3c;
}

#clear-history:hover {
    background-color: #c0392b;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    padding: 2rem;
    border-radius: var(--radius);
    max-width: 800px;
    width: 90%;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
}

.help-content {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 1rem;
}

.help-content h3 {
    margin: 1.5rem 0 0.5rem;
    color: var(--primary-color);
}

.help-content ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.help-content li {
    margin-bottom: 0.5rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
    background-color: var(--card-bg);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

footer p {
    margin-bottom: 0.5rem;
    color: #777;
}

/* Responsive Design */
@media (max-width: 768px) {
    .color-selection {
        grid-template-columns: 1fr;
    }

    .color-controls {
        flex-direction: column;
    }

    .color-history {
        grid-template-columns: 1fr;
    }

    .tool-tabs {
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .tab-btn {
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .slider-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .slider-group label {
        width: auto;
    }

    .preview-options {
        flex-direction: column;
    }
}
