/* ColorPick - Main Styles */

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --background: #ffffff;
    --background-secondary: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 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);
    --radius: 12px;
    --radius-sm: 8px;
}

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

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

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

/* Header */
.header {
    background: var(--background);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary-color);
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
}

.language-select {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--background);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

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

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 40px;
}

.hero h2 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 18px;
    color: var(--text-secondary);
}

/* Upload Section */
.upload-section {
    margin-bottom: 40px;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 60px 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: var(--background-secondary);
    margin-bottom: 20px;
}

/* URL Input Section */
.url-input-section {
    margin-top: 20px;
}

.url-input-container {
    display: flex;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
}

.url-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--background);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

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

.url-hint {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.upload-area p {
    margin: 8px 0;
    color: var(--text-secondary);
}

.upload-hint {
    font-size: 14px;
    opacity: 0.8;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--background-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* Editor Section */
.editor-section {
    margin-bottom: 40px;
}

.editor-container {
    background: var(--background-secondary);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.canvas-wrapper {
    position: relative;
    max-width: 100%;
    overflow: hidden;
    border-radius: var(--radius-sm);
}

#image-canvas {
    max-width: 100%;
    height: auto;
    display: block;
    cursor: crosshair;
    background: #f1f5f9;
    border-radius: var(--radius-sm);
}

.color-picker {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-sm);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
}

.color-preview {
    width: 100%;
    height: 80px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.color-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.color-format {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.format-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 40px;
}

.format-value {
    flex: 1;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    color: var(--text-primary);
}

.copy-btn {
    padding: 4px 8px;
    font-size: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.copy-btn.copied {
    background: #10b981;
}

/* Palette Section */
.palette-section {
    margin-bottom: 40px;
}

.palette-section h3 {
    font-size: 24px;
    margin-bottom: 20px;
}

.palette-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.palette-color {
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.palette-color:hover {
    transform: translateY(-4px);
}

.palette-color-preview {
    height: 100px;
    width: 100%;
}

.palette-color-info {
    padding: 12px;
    background: var(--background);
}

.palette-color-value {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.palette-color-actions {
    display: flex;
    gap: 8px;
}

.palette-color-actions button {
    flex: 1;
    padding: 6px;
    font-size: 12px;
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
}

.palette-color-actions button:hover {
    background: var(--border-color);
}

/* How To Section */
.how-to-section {
    margin: 60px 0;
}

.how-to-section h3 {
    font-size: 28px;
    text-align: center;
    margin-bottom: 40px;
}

.steps-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.step-card {
    background: var(--background-secondary);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    position: relative;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    color: white;
    font-size: 20px;
    font-weight: 700;
    border-radius: 50%;
    margin-bottom: 20px;
}

.step-card h4 {
    font-size: 20px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.step-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Formats Section */
.formats-section {
    margin: 60px 0;
}

.formats-section h3 {
    font-size: 28px;
    text-align: center;
    margin-bottom: 16px;
}

.section-intro {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.formats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.format-card {
    background: var(--background-secondary);
    border-radius: var(--radius);
    padding: 24px;
    transition: transform 0.2s;
}

.format-card:hover {
    transform: translateY(-4px);
}

.format-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.format-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    background: var(--primary-color);
    color: white;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.format-card h4 {
    font-size: 18px;
    color: var(--text-primary);
}

.format-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
}

.format-use {
    font-size: 13px;
    color: var(--primary-color);
    font-weight: 500;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* Uses Section */
.uses-section {
    margin: 60px 0;
}

.uses-section h3 {
    font-size: 28px;
    text-align: center;
    margin-bottom: 40px;
}

.uses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.use-card {
    background: var(--background-secondary);
    border-radius: var(--radius);
    padding: 24px;
    transition: transform 0.2s;
}

.use-card:hover {
    transform: translateY(-4px);
}

.use-icon {
    font-size: 36px;
    margin-bottom: 16px;
}

.use-card h4 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.use-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Tips Section */
.tips-section {
    margin: 60px 0;
}

.tips-section h3 {
    font-size: 28px;
    text-align: center;
    margin-bottom: 40px;
}

.tips-list {
    max-width: 800px;
    margin: 0 auto;
}

.tip-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: var(--background-secondary);
    border-radius: var(--radius);
    margin-bottom: 16px;
    transition: transform 0.2s;
}

.tip-item:hover {
    transform: translateX(8px);
}

.tip-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.tip-content h4 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.tip-content p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Features Section */
.features-section {
    margin-top: 60px;
}

.features-section h3 {
    font-size: 28px;
    text-align: center;
    margin-bottom: 40px;
}

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

.feature-card {
    background: var(--background-secondary);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: transform 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.feature-card h4 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Footer */
.footer {
    background: var(--background-secondary);
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Responsive - Mobile Optimization */
@media (max-width: 768px) {
    /* Typography - Improved Readability */
    body {
        font-size: 16px;
        line-height: 1.7;
    }
    
    .hero h2 {
        font-size: 26px;
        line-height: 1.4;
        margin-bottom: 16px;
    }
    
    .hero p {
        font-size: 16px;
        line-height: 1.6;
    }
    
    h1 {
        font-size: 22px !important;
        line-height: 1.4 !important;
    }
    
    h2 {
        font-size: 20px !important;
        line-height: 1.5 !important;
        margin-bottom: 14px !important;
    }
    
    h3 {
        font-size: 18px !important;
        line-height: 1.5 !important;
        margin-bottom: 12px !important;
    }
    
    h4 {
        font-size: 16px !important;
        line-height: 1.5 !important;
    }
    
    p {
        font-size: 16px;
        line-height: 1.8;
        margin-bottom: 16px;
    }
    
    li {
        font-size: 15px;
        line-height: 1.7;
        margin-bottom: 10px;
    }
    
    /* Upload Area - More Spacious */
    .upload-area {
        padding: 40px 20px;
        margin: 10px 0;
    }
    
    .upload-icon svg {
        width: 56px;
        height: 56px;
        margin-bottom: 16px;
    }
    
    .upload-area p {
        font-size: 16px;
        margin: 10px 0;
    }
    
    /* URL Input */
    .url-input-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .url-input {
        width: 100%;
    }
    
    /* Color Picker */
    .color-picker {
        position: relative;
        top: auto;
        right: auto;
        margin-top: 20px;
        width: 100%;
    }
    
    /* Palette */
    .palette-container {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .palette-color-preview {
        height: 80px;
    }
    
    /* Features Grid */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* How-to Steps - Better Spacing */
    .steps-container {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 10px 0;
    }
    
    .step-card {
        padding: 24px 20px;
    }
    
    /* Formats Grid */
    .formats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .format-card {
        padding: 20px;
    }
    
    /* Uses Grid */
    .uses-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .use-card {
        padding: 20px;
    }
    
    /* Tips - Better Layout */
    .tip-item {
        flex-direction: column;
        gap: 12px;
        padding: 20px;
        margin-bottom: 16px;
    }
    
    .tip-icon {
        font-size: 36px;
    }
    
    /* Content Sections */
    .how-to-section,
    .formats-section,
    .uses-section,
    .tips-section,
    .features-section {
        margin: 50px 0;
        padding: 0 10px;
    }
    
    /* Navigation */
    .header .container {
        padding: 0 15px;
    }
    
    .logo h1 {
        font-size: 18px;
    }
    
    .language-select {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    /* Buttons - Touch-friendly */
    .btn {
        padding: 14px 20px;
        font-size: 15px;
        min-height: 48px; /* Touch target size */
    }
    
    .copy-btn {
        min-height: 36px;
        min-width: 60px;
    }
    
    /* Canvas */
    .canvas-wrapper {
        touch-action: none; /* Prevent scroll while picking colors */
    }
    
    /* Footer */
    .footer p {
        font-size: 12px;
    }
    
    /* Blog Cards */
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 10px 0;
    }
    
    .blog-card {
        margin-bottom: 10px;
    }
    
    .blog-card-content {
        padding: 20px;
    }
    
    /* FAQ */
    .faq-item {
        padding: 20px;
        margin-bottom: 16px;
    }
    
    .faq-question {
        font-size: 16px;
        line-height: 1.5;
    }
    
    .faq-answer {
        font-size: 15px;
        line-height: 1.7;
    }
    
    /* Container Padding */
    .container {
        padding: 0 20px;
    }
    
    /* Main Content */
    .main {
        padding: 30px 0;
    }
    
    /* Legal Pages */
    .legal-content,
    .about-content,
    .contact-content {
        padding: 30px 20px;
        margin: 20px;
    }
    
    /* Newsletter */
    .newsletter {
        padding: 30px 20px;
        margin: 30px 20px;
    }
    
    .newsletter-form {
        flex-direction: column;
        gap: 12px;
    }
    
    .newsletter-form input {
        width: 100%;
        padding: 14px;
        font-size: 16px;
    }
    
    .newsletter-form button {
        width: 100%;
        padding: 14px;
        font-size: 16px;
        min-height: 48px;
    }
}

/* Small Mobile Devices (iPhone SE, etc.) */
@media (max-width: 375px) {
    .hero h2 {
        font-size: 20px;
    }
    
    .hero p {
        font-size: 13px;
    }
    
    .upload-area {
        padding: 20px 10px;
    }
    
    .palette-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .color-format {
        flex-wrap: wrap;
    }
    
    .format-value {
        font-size: 11px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 48px;
        padding: 14px 24px;
    }
    
    .copy-btn {
        min-height: 40px;
        min-width: 70px;
        padding: 8px 16px;
    }
    
    .language-select {
        min-height: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .feature-card:hover,
    .use-card:hover,
    .palette-color:hover {
        transform: none;
    }
    
    /* Add active state */
    .btn:active {
        transform: scale(0.98);
    }
    
    .copy-btn:active {
        opacity: 0.8;
    }
}

/* Safe Area for Notched Devices (iPhone X+) */
@supports (padding: max(0px)) {
    .header {
        padding-top: max(16px, env(safe-area-inset-top));
    }
    
    .footer {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
    
    .main {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
}

/* Prevent text size adjustment on orientation change */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Remove tap highlight on mobile */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Improve form elements on mobile */
input, select, textarea, button {
    font-size: 16px; /* Prevents zoom on iOS */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 8px;
}

/* Better scrolling on mobile */
body {
    -webkit-overflow-scrolling: touch;
}

/* Prevent pull-to-refresh on mobile */
body {
    overscroll-behavior-y: contain;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Loading State */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
