/* HTML Color Codes Tool Styles */

/* Tool Container - Full Page Layout */
.color-codes-tool {
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    padding: 0;
    margin: 0;
}

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

/* Tool Header */
.tool-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem 0;
}

.tool-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: rgb(34, 33, 33);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.tool-header h1 i {
    color: var(--primary-color);
    font-size: 1.8rem;
}

.tool-description {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 0;
    line-height: 1.6;
}

/* Color Picker Card */
.color-picker-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.color-picker-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Picker Section */
.picker-section {
    text-align: center;
}

.picker-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.picker-header p {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

/* Top Format Display */
.top-formats {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
    padding: 1.5rem 0;
}

.top-format-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    min-width: 100px;
}

.top-format-item .format-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
    text-align: center;
}

.top-format-item .format-value {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 90px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.top-format-item .format-value::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s ease;
}

.top-format-item .format-value:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.top-format-item .format-value:hover::before {
    left: 100%;
}

.top-format-item .format-value:active {
    transform: translateY(-1px) scale(1.01);
}

.picker-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.color-canvas-container {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

#colorCanvas {
    display: block;
    cursor: crosshair;
    border-radius: 8px;
    width: 600px;
    height: 380px;
}

.picker-cursor {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.hue-slider-container {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

#hueSlider {
    display: block;
    cursor: pointer;
    border-radius: 10px;
    width: 30px;
    height: 280px;
}

.hue-cursor {
    position: absolute;
    left: 50%;
    width: 34px;
    height: 6px;
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.4);
    border-radius: 3px;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Preview Section */
.preview-section {
    display: flex;
    justify-content: center;
}

.color-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
}

.preview-swatch {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    border: 3px solid white;
    box-shadow: var(--shadow-lg);
    background: #3bf654;
}

.preview-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.preview-label {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
}

.preview-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.preview-input {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    font-family: 'Courier New', monospace;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 0.5rem 2.5rem 0.5rem 0.5rem;
    transition: all 0.2s ease;
    min-width: 140px;
    text-align: center;
}

.preview-input:hover {
    background: rgba(59, 130, 246, 0.05);
    border-color: rgba(59, 130, 246, 0.2);
}

.preview-input:focus {
    outline: none;
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.preview-input.valid {
    border-color: #10b981;
    background: #f0fdf4;
}

.preview-input.invalid {
    border-color: #ef4444;
    background: #fef2f2;
}

.preview-input.processing {
    border-color: #f59e0b;
    background: #fffbeb;
}

.preview-status {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    pointer-events: none;
}

.preview-status.show {
    opacity: 1;
}

.preview-status.valid {
    color: #10b981;
}

.preview-status.invalid {
    color: #ef4444;
}

.preview-status.processing {
    color: #f59e0b;
}

/* Action Controls */
.action-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.random-btn,
.clear-btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
}

.random-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, #2563eb 100%);
    color: white;
}

.random-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.clear-btn {
    background: #f3f4f6;
    color: var(--text-color);
}

.clear-btn:hover {
    background: #e5e7eb;
}

/* Formats Section */
.formats-section {
    margin-bottom: 2rem;
}

.formats-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.formats-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.formats-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.formats-description {
    font-size: 0.875rem;
    color: var(--text-light);
    margin: 0;
}

.formats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.format-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.format-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.format-label i {
    color: var(--primary-color);
    font-size: 0.875rem;
}

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

.format-input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    transition: all 0.2s ease;
    background: white;
}

.color-input-field {
    padding-right: 3rem;
}

.color-input-field.valid {
    border-color: #10b981;
    background: #f0fdf4;
}

.color-input-field.invalid {
    border-color: #ef4444;
    background: #fef2f2;
}

.color-input-field.processing {
    border-color: #f59e0b;
    background: #fffbeb;
}

.format-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.copy-btn {
    padding: 0.875rem;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
}

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

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

/* Input Status Indicator */
.input-status {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    pointer-events: none;
}

.input-status.show {
    opacity: 1;
}

.input-status.valid {
    color: #10b981;
}

.input-status.invalid {
    color: #ef4444;
}

.input-status.processing {
    color: #f59e0b;
}

/* Input Hint */
.input-hint {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-left: 0.25rem;
    font-weight: 400;
}



/* Contrast Section */
.contrast-section {
    margin-bottom: 2rem;
}

.contrast-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.contrast-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.contrast-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.contrast-title i {
    color: var(--primary-color);
}

.contrast-description {
    font-size: 0.875rem;
    color: var(--text-light);
    margin: 0;
}

.contrast-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.contrast-preview {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.contrast-demo {
    flex: 1;
    min-height: 150px;
    background: #ffffff;
    color: #3bf664;
    border-radius: 12px;
    border: 3px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.contrast-text {
    text-align: center;
    line-height: 1.4;
}

.contrast-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contrast-ratio {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
}

.ratio-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-color);
}

.ratio-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
}

.contrast-ratings {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rating-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.rating-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
}

.rating-status {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
}

.rating-status.pass {
    background: #d1fae5;
    color: #065f46;
}

.rating-status.fail {
    background: #fee2e2;
    color: #991b1b;
}

.contrast-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.contrast-btn {
    padding: 0.875rem 1.5rem;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    background: white;
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
}

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

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

/* History Section */
.history-section {
    margin-bottom: 2rem;
}

.history-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-title i {
    color: var(--primary-color);
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
}

.history-item {
    aspect-ratio: 1;
    border-radius: 6px;
    border: 2px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.history-item:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.history-item::after {
    content: attr(data-color);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.history-item:hover::after {
    opacity: 1;
}

/* SEO Content Styles */
.seo-content {
    background: white;
    margin-top: 3rem;
    padding: 3rem 0;
    border-top: 1px solid #e5e7eb;
}

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

.seo-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 1rem;
    margin-top: 2rem;
}

.seo-content h2:first-child {
    margin-top: 0;
}

.seo-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
}

.seo-content p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.seo-content ul,
.seo-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.seo-content li {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.seo-content strong {
    color: var(--text-color);
    font-weight: 600;
}

.seo-content section {
    margin-bottom: 2rem;
}

/* Related Tools Section */
.related-tools-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.related-tools-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.related-tools-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.related-tools-header h3 i {
    color: #667eea;
}

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

.related-tool-link {
    background: #f8fafc;
    color: #667eea;
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    border: 1px solid #e5e7eb;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.related-tool-link:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

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

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

    .color-picker-card,
    .formats-card,
    .contrast-card {
        padding: 1.5rem;
    }

    .tool-header h1 {
        font-size: 1.75rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .color-picker-content {
        gap: 1.5rem;
    }

    .top-formats {
        gap: 1rem;
        padding: 0.75rem;
    }

    .top-format-item {
        min-width: 60px;
    }

    .top-format-item .format-value {
        font-size: 0.8rem;
        padding: 0.2rem 0.4rem;
        min-width: 60px;
    }

    .picker-container {
        flex-direction: column;
        gap: 1rem;
    }

    #colorCanvas {
        width: 320px !important;
        height: 220px !important;
    }

    #hueSlider {
        width: 320px !important;
        height: 25px !important;
    }

    .hue-cursor {
        top: 50% !important;
        left: auto !important;
        width: 6px !important;
        height: 29px !important;
        transform: translate(-50%, -50%) !important;
    }

    .color-preview {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .preview-swatch {
        width: 80px;
        height: 80px;
    }

    .preview-input {
        font-size: 1.25rem;
        min-width: 120px;
        padding: 0.375rem 2rem 0.375rem 0.375rem;
    }

    .preview-status {
        right: 0.375rem;
        width: 18px;
        height: 18px;
    }

    .action-controls {
        flex-direction: column;
        align-items: center;
    }

    .random-btn,
    .clear-btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }

    .formats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }



    .contrast-preview {
        flex-direction: column;
        gap: 1rem;
    }

    .contrast-demo {
        min-height: 100px;
        font-size: 1.5rem;
    }

    .contrast-controls {
        flex-direction: column;
        align-items: center;
    }

    .contrast-btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }

    .history-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 0.5rem;
    }

    .content-container {
        padding: 0 1rem;
    }

    .seo-content h2 {
        font-size: 1.375rem;
    }

    .seo-content h3 {
        font-size: 1.125rem;
    }

    .related-tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .related-tool-link {
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
    }

    .related-tools-section {
        padding: 1rem;
    }

    .related-tools-grid {
        grid-template-columns: 1fr;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .tool-header h1 {
        font-size: 1.5rem;
    }

    #colorCanvas {
        width: 280px !important;
        height: 180px !important;
    }

    #hueSlider {
        width: 280px !important;
        height: 22px !important;
    }

    .hue-cursor {
        top: 50% !important;
        left: auto !important;
        width: 6px !important;
        height: 26px !important;
        transform: translate(-50%, -50%) !important;
    }



    .format-input {
        font-size: 0.875rem;
        padding: 0.75rem;
    }

    .color-input-field {
        padding-right: 2.5rem;
    }

    .input-status {
        right: 50px;
        width: 20px;
        height: 20px;
    }

    .copy-btn {
        padding: 0.75rem;
        min-width: 40px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .history-item:hover,
    .copy-btn:hover,
    .random-btn:hover,
    .clear-btn:hover {
        transform: none;
    }

    .history-item:active {
        transform: scale(0.95);
    }

    .copy-btn:active,
    .random-btn:active,
    .clear-btn:active {
        transform: scale(0.95);
    }
}

/* Loading and Animation States */
.format-input.updating {
    background: #f8fafc;
    color: var(--text-light);
}

.copy-btn.copying {
    background: #fbbf24;
    border-color: #fbbf24;
    color: white;
}

/* Accessibility Improvements */
.picker-cursor:focus,
.hue-cursor:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
