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

:root {
    --primary: #e53e3e;
    --primary-dark: #c53030;
    --secondary: #4a5568;
    --success: #38a169;
    --gray-50: #f7fafc;
    --gray-100: #edf2f7;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #a0aec0;
    --gray-500: #718096;
    --gray-600: #4a5568;
    --gray-700: #2d3748;
    --gray-800: #1a202c;
    --gray-900: #171923;
    --white: #ffffff;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    text-decoration: none;
}

.nav-logo i {
    font-size: 1.5rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-menu a {
    text-decoration: none;
    color: var(--gray-600);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary);
    background: var(--gray-100);
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

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

/* Page Header */
.page-header {
    text-align: center;
    margin-bottom: 3rem;
}

.tool-icon-large {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: var(--white);
    font-size: 2rem;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.page-header p {
    font-size: 1.1rem;
    color: var(--gray-600);
    max-width: 600px;
    margin: 0 auto;
}

/* Converter Section */
.converter-section {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 3rem;
}

.color-picker-main {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.color-preview {
    width: 25%;
    height: 250px;
    border-radius: 8px;
    border: 2px solid var(--gray-300);
    background: #32a852;
}

.color-field-container {
    flex: 1;
}

.color-field {
    width: 100%;
    height: 250px;
    border-radius: 8px;
    border: 2px solid var(--gray-300);
    position: relative;
    cursor: crosshair;
    background: linear-gradient(to bottom, transparent, black), linear-gradient(to right, white, #32a852);
}

.color-selector {
    width: 12px;
    height: 12px;
    border: 2px solid white;
    border-radius: 50%;
    position: absolute;
    pointer-events: none;
    box-shadow: 0 0 3px rgba(0,0,0,0.5);
    transform: translate(-50%, -50%);
    top: 30%;
    left: 70%;
}

.hue-slider-container {
    margin-bottom: 1.5rem;
}

.hue-slider {
    width: 100%;
    height: 20px;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    background: linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
}

.hue-handle {
    width: 20px;
    height: 20px;
    border: 2px solid white;
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 33%;
    transform: translateX(-50%);
    cursor: pointer;
    box-shadow: 0 0 3px rgba(0,0,0,0.5);
}

.hex-input-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

#hexInput {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--gray-300);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    text-transform: uppercase;
}

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

.hex-input-container button {
    padding: 0.75rem 1rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.hex-input-container button:hover {
    background: var(--primary-dark);
}

.color-values-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.value-box {
    background: var(--gray-50);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    text-align: center;
}

.value-box label {
    display: block;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.value-box div {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--gray-800);
}

/* Features Info */
.features-info {
    margin-top: 4rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
}

.feature-card i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.feature-card h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--gray-600);
    font-size: 0.9rem;
}

/* Related Tools Section */
.related-tools-section {
    text-align: center;
    margin: 4rem 0;
}

.related-tools-section h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 1rem;
}

.related-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    max-width: 500px;
    margin: 0 auto;
}

.related-tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    text-decoration: none;
    color: var(--gray-700);
    transition: all 0.2s;
    font-size: 0.9rem;
}

.related-tool:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
}

.related-tool i {
    font-size: 1.5rem;
}

/* SEO Content */
.seo-content {
    margin-top: 4rem;
    background: var(--white);
    border-radius: 12px;
    padding: 3rem 2rem;
    box-shadow: var(--shadow);
}

.seo-section h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
}

.seo-section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 2rem 0 1rem;
}

.seo-section p {
    color: var(--gray-700);
    line-height: 1.8;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

/* Footer */
.footer {
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    padding: 2rem 0;
    text-align: center;
    color: var(--gray-600);
}

/* Image Picker Section */
.image-picker-section {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 3rem;
    text-align: center;
}

.image-picker-section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
}

.upload-btn {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.upload-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.image-canvas-container {
    margin-top: 1.5rem;
}

.canvas-wrapper {
    position: relative;
    display: inline-block;
}

#imageCanvas {
    max-width: 100%;
    max-height: 400px;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    cursor: crosshair;
    box-shadow: var(--shadow);
}

.pixel-magnifier {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 3px solid var(--white);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
    pointer-events: none;
    display: none;
    z-index: 10;
}

#magnifierCanvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    transform: translate(-50%, -50%);
    border: 1px solid var(--white);
    border-radius: 50%;
    box-shadow: 0 0 3px rgba(0,0,0,0.5);
}

.crosshair::before,
.crosshair::after {
    content: '';
    position: absolute;
    background: var(--white);
    box-shadow: 0 0 2px rgba(0,0,0,0.5);
}

.crosshair::before {
    top: 50%;
    left: 2px;
    right: 2px;
    height: 1px;
    transform: translateY(-50%);
}

.crosshair::after {
    left: 50%;
    top: 2px;
    bottom: 2px;
    width: 1px;
    transform: translateX(-50%);
}

.image-canvas-container p {
    margin-top: 1rem;
    color: var(--gray-600);
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
    
    .color-picker-main {
        flex-direction: column;
    }
    
    .color-preview {
        width: 100%;
        height: 100px;
    }
    
    .color-values-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
}