* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

 :root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --background-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --border-radius: 12px;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --hover-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

:root[data-theme="dark"] {
    --primary-color: #ecf0f1;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --background-color: #1a1f36;
    --card-bg: #2c3e50;
    --text-color: #ecf0f1;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --hover-shadow: 0 8px 15px rgba(0, 0, 0, 0.4);
}

[dir="ltr"] {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

[dir="rtl"] {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
}

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

.settings-bar {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1rem;
}

.theme-toggle,
.language-toggle {
    background: var(--card-bg);
    border: 2px solid var(--secondary-color);
    color: var(--text-color);
    padding: 0.75rem 1.25rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
    font-weight: 500;
    box-shadow: var(--box-shadow);
}

.theme-toggle:hover,
.language-toggle:hover {
    background: var(--secondary-color);
    color: white;
}

header {
    text-align: center;
    padding: 2rem 0;
}

header h1 {
    color: var(--primary-color);
    font-size: 3rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

header h1 i {
    color: var(--secondary-color);
}

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

main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

/* تحسين تجاوب الموقع مع مختلف أحجام الشاشات */
@media (min-width: 320px) {
    .container {
        padding: 1rem;
    }
    .color-input input[type="color"],
    .color-input input[type="text"] {
        width: 100px;
        height: 100px;
    }
    .color-inputs {
        flex-direction: column;
        gap: 2rem;
    }
    .mix-icon {
        transform: rotate(90deg);
        margin: 1rem 0;
    }
}

@media (min-width: 480px) {
    .container {
        padding: 1.5rem;
    }
    .color-input input[type="color"],
    .color-input input[type="text"] {
        width: 120px;
        height: 120px;
    }
}

@media (min-width: 768px) {
    main {
        grid-template-columns: repeat(2, 1fr);
    }
    .container {
        padding: 2rem;
    }
    .color-inputs {
        flex-direction: row;
    }
    .mix-icon {
        transform: rotate(0);
        margin: 0 1rem;
    }
    .color-input input[type="color"],
    .color-input input[type="text"] {
        width: 140px;
        height: 140px;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 2.5rem;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
}

.color-mixer, .image-extractor {
    background-color: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.color-mixer:hover, .image-extractor:hover {
    transform: translateY(-8px);
    box-shadow: var(--hover-shadow);
    border-color: var(--secondary-color);
}

section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
}

.color-inputs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.color-input {
    flex: 1;
    text-align: center;
}

.color-input label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.color-input input[type="color"] {
    width: 140px;
    height: 140px;
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    margin-bottom: 1.5rem;
    transition: var(--transition);
    box-shadow: var(--box-shadow);
    position: relative;
    overflow: hidden;
}

.color-input input[type="color"]:hover {
    transform: scale(1.08);
    box-shadow: var(--hover-shadow);
}

.color-input input[type="text"] {
    width: 140px;
    text-align: center;
    padding: 1rem;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    font-family: monospace;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--primary-color);
    background: var(--card-bg);
    transition: var(--transition);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.color-input input[type="text"]:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.2);
}

.mix-icon {
    font-size: 2rem;
    color: var(--secondary-color);
    margin: 0 1rem;
}

.result-section {
    text-align: center;
}

.result-color {
    width: 100%;
    height: 100px;
    margin: 1rem auto;
    border-radius: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

#resultColorText {
    width: 100%;
    max-width: 300px;
    text-align: center;
    padding: 0.5rem;
    margin: 1rem auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: monospace;
}

button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: var(--box-shadow);
}

button:hover {
    background-color: #2980b9;
}

.upload-section {
    text-align: center;
    margin-bottom: 2rem;
    max-width: 100%;
    overflow: hidden;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: clamp(1rem, 5vw, 2rem);
    border: 2px dashed var(--secondary-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    min-height: 200px;
    justify-content: center;
}

.upload-label:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

.upload-label i {
    font-size: 3rem;
    color: var(--secondary-color);
}

#imageUpload {
    display: none;
}

.image-preview {
    max-width: 100%;
    margin: 1rem 0;
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    object-fit: contain;
    aspect-ratio: 16/9;
}

.extracted-colors {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: clamp(0.5rem, 2vw, 1rem);
    justify-content: center;
    margin-top: 1rem;
    width: 100%;
}

.color-box {
    width: 100%;
    text-align: center;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.color-preview {
    width: 120px;
    height: 120px;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.color-code {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-color);
    display: block;
    margin-bottom: 0.5rem;
}

.copy-btn {
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    width: 100%;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.copy-btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: var(--hover-shadow);
}

.copy-btn:active {
    transform: translateY(0);
}

.copy-btn i {
    font-size: 0.9rem;
}

.image-hosting {
    background-color: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
    transition: var(--transition);
    border: 2px dashed var(--secondary-color);
    position: relative;
    overflow: hidden;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.image-hosting::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 48%, var(--secondary-color) 49%, var(--secondary-color) 51%, transparent 52%);
    background-size: 10px 10px;
    opacity: 0.1;
    pointer-events: none;
}

.image-hosting:hover {
    transform: translateY(-8px);
    box-shadow: var(--hover-shadow);
    border-color: var(--accent-color);
}

.image-hosting:hover::before {
    animation: patternMove 20s linear infinite;
}

@keyframes patternMove {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 50px 50px;
    }
}

.upload-progress {
    width: 100%;
    height: 12px;
    background-color: var(--background-color);
    border-radius: var(--border-radius);
    margin: 1.5rem 0;
    overflow: hidden;
    display: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), var(--accent-color));
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.image-link-section {
    display: none;
    margin-top: 1rem;
}

.image-link-section input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    font-family: monospace;
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    background: rgba(52, 152, 219, 0.1);
}

.image-link-section .copy-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.image-link-section .copy-btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: var(--hover-shadow);
}

.copy-btn:active {
    transform: translateY(0);
}

footer {
    text-align: center;
    margin-top: 3rem;
    color: #666;
}

footer i {
    color: var(--accent-color);
}

.logo {
    margin: 1rem auto;
    text-align: center;
}

.logo svg {
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
}

.logo svg:hover {
    transform: scale(1.05);
}