/**
 * ConvMaster - Color Code Converter Styles
 * 
 * @package    ConvMaster
 * @version    1.0.0
 */

/* =====================================================
   TOOL PAGE LAYOUT
   ===================================================== */
.tool-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.tool-header__icon {
    font-size: 2.5rem;
}

.tool-header__icon .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
}

.tool-header__icon .icon--colors {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.2), rgba(251, 191, 36, 0.2));
}

.tool-header__text h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: var(--text-primary);
}

.tool-header__text p {
    margin: 0;
    color: var(--text-secondary);
}

/* =====================================================
   COLOR CONVERTER WIDGET
   ===================================================== */
.color-converter {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    padding: 2rem;
}

.color-converter__workspace {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2.5rem;
    align-items: start;
}

@media (max-width: 768px) {
    .color-converter__workspace {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .color-converter__picker-column {
        max-width: 320px;
        margin: 0 auto;
    }
}

/* =====================================================
   COLOR PICKER
   ===================================================== */
.color-converter__picker-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.color-picker {
    position: relative;
    width: 280px;
    height: 280px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: crosshair;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.color-picker canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.color-picker__cursor {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
    top: 50%;
    left: 50%;
}

/* =====================================================
   HUE SLIDER
   ===================================================== */
.hue-slider {
    position: relative;
    width: 280px;
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
}

.hue-slider__track {
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, 
        hsl(0, 100%, 50%),
        hsl(60, 100%, 50%),
        hsl(120, 100%, 50%),
        hsl(180, 100%, 50%),
        hsl(240, 100%, 50%),
        hsl(300, 100%, 50%),
        hsl(360, 100%, 50%)
    );
    border-radius: 10px;
}

.hue-slider__thumb {
    position: absolute;
    top: 50%;
    left: 0;
    width: 24px;
    height: 24px;
    background: white;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transform: translate(-50%, -50%);
    cursor: grab;
    transition: transform 0.1s ease;
}

.hue-slider__thumb:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.1);
}

/* =====================================================
   COLOR PREVIEW
   ===================================================== */
.color-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.color-preview__box {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    background: #6366f1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.color-preview__label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* =====================================================
   COLOR VALUES COLUMN
   ===================================================== */
.color-converter__values-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* =====================================================
   COLOR INPUT GROUPS
   ===================================================== */
.color-input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.color-input-group__label {
    min-width: 55px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-input-group__field {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color 0.2s ease;
}

.color-input-group__field:focus-within {
    border-color: var(--primary);
}

.color-input-group__prefix {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.color-input-group__separator {
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0 0.125rem;
}

.color-input {
    width: 100%;
    padding: 0.375rem 0.25rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: transparent;
    border: none;
    outline: none;
    text-align: center;
}

.color-input--hex {
    text-transform: uppercase;
    text-align: left;
}

.color-input-group__field--single .color-input {
    flex: 1;
}

.color-input-group__field--triple .color-input {
    width: 50px;
    flex: none;
}

.color-input-group__field--quad .color-input {
    width: 40px;
    flex: none;
}

/* Remove number input spinners */
.color-input[type="number"]::-webkit-outer-spin-button,
.color-input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.color-input[type="number"] {
    -moz-appearance: textfield;
}

/* Copy Button */
.btn-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-copy:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.btn-copy svg {
    width: 16px;
    height: 16px;
}

/* =====================================================
   RANDOM BUTTON
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

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

.btn--random {
    width: 100%;
    margin-top: 0.5rem;
}

.btn svg {
    flex-shrink: 0;
}

/* =====================================================
   INFO & PRIVACY
   ===================================================== */
.color-converter__info {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-md);
}

.color-converter__info p {
    font-size: 0.8rem;
    color: var(--primary);
    margin: 0;
}

.color-converter__privacy {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.color-converter__privacy p {
    font-size: 0.8rem;
    color: var(--success);
    margin: 0;
}

/* =====================================================
   SEO CONTENT
   ===================================================== */
.tool-content {
    margin-top: 3rem;
}

.tool-section {
    margin-bottom: 2.5rem;
}

.tool-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.tool-section p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
}

.feature-card__icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: block;
}

.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Formats Grid */
.formats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.format-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.format-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 0.5rem;
}

.format-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0 0 0.75rem;
    line-height: 1.5;
}

.format-card code {
    display: block;
    padding: 0.5rem 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    word-break: break-all;
}

/* Steps Grid */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    position: relative;
}

.step-card__number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 50%;
    margin-bottom: 0.75rem;
}

.step-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.step-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.faq-item summary {
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.25rem;
    color: var(--text-muted);
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item p {
    padding: 0 1.5rem 1rem;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* =====================================================
   NOTIFICATION
   ===================================================== */
.copy-notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 0.75rem 1.5rem;
    background: var(--success);
    color: white;
    font-weight: 600;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
}

.copy-notification--visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* =====================================================
   HIDDEN ELEMENTS
   ===================================================== */
[hidden] {
    display: none !important;
}

/* =====================================================
   LIGHT THEME ADJUSTMENTS
   ===================================================== */
[data-theme="light"] .color-input-group__field {
    background: var(--bg-primary);
}

[data-theme="light"] .color-converter {
    background: var(--bg-card);
}

[data-theme="light"] .format-card code {
    background: #f1f5f9;
}

[data-theme="light"] .color-preview {
    background: #f1f5f9;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 640px) {
    .tool-page {
        padding: 1rem;
    }
    
    .color-converter {
        padding: 1.25rem;
    }
    
    .color-picker {
        width: 100%;
        max-width: 280px;
        height: auto;
        aspect-ratio: 1;
    }
    
    .hue-slider {
        width: 100%;
        max-width: 280px;
    }
    
    .color-input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .color-input-group__label {
        min-width: unset;
    }
    
    .color-input-group__field--triple .color-input,
    .color-input-group__field--quad .color-input {
        flex: 1;
        min-width: 0;
    }
    
    .formats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}
