/* --- Main Layout & Input Section --- */
main.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 1rem 2rem;
}

.color-input-section {
    text-align: center;
    padding: 2rem;
    background-color: var(--primary-bg-color);
    border-radius: 12px;
    margin-bottom: 2rem;
    border: 1px solid var(--input-border-color);
}

.color-input-section h1 {
    color: var(--primary-text-color);
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
}

.color-input-section .subtitle {
    color: var(--secondary-text-color);
    margin-bottom: 1.5rem;
}

#color-form {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 500px;
}

#color-input {
    width: 100%;
    padding: 1rem 3.5rem 1rem 1rem;
    font-size: 1.3rem;
    font-family: 'Courier New', Courier, monospace;
    border: 2px solid var(--input-border-color);
    border-radius: 8px;
    background-color: var(--input-bg-color);
    color: var(--input-text-color);
    transition: all 0.3s ease;
}

#color-input:focus {
    outline: none;
    border-color: var(--button-hover-bg-color);
    box-shadow: 0 0 15px var(--input-shadow);
}

#color-picker {
    position: absolute;
    right: 8px;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    border-radius: 4px;
}

/* --- Color Header Section --- */
.color-header {
    background-color: var(--primary-bg-color);
    border: 1px solid var(--input-border-color);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.color-header-content {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.main-swatch {
    min-width: 200px;
    width: 200px;
    height: 200px;
    border-radius: 12px;
    border: 3px solid var(--input-border-color);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.color-info {
    flex: 1;
}

.color-info h1 {
    font-size: 2rem;
    margin: 0 0 1rem 0;
    color: var(--primary-text-color);
    font-weight: 700;
}

.color-info p {
    color: var(--secondary-text-color);
    margin: 0 0 1.5rem 0;
    line-height: 1.6;
    font-size: 1rem;
}

#color-charts {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
}

.color-chart {
    flex: 1;
}

.color-chart h3 {
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-bars {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chart-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-bar-label {
    width: 15px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-text-color);
}

.chart-bar-bg {
    flex: 1;
    height: 24px;
    background-color: var(--input-bg-color);
    border-radius: 4px;
    overflow: visible;
    position: relative;
    border: 1px solid var(--input-border-color);
}

.chart-bar-fill {
    height: 100%;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;
    border-radius: 3px;
}

.chart-bar-value {
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.chart-bar-value-outside {
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-text-color);
}

.chart-bar-value-outside.right {
    left: auto;
    right: 0.5rem;
}

/* --- Tab Navigation --- */
.tab-navigation {
    display: flex;
    gap: 0.5rem;
    background-color: var(--primary-bg-color);
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--input-border-color);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    flex-wrap: wrap;
}

.tab-button {
    padding: 0.8rem 1.5rem;
    border: none;
    background-color: transparent;
    color: var(--secondary-text-color);
    cursor: pointer;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab-button:hover {
    background-color: var(--input-bg-color);
    color: var(--primary-text-color);
}

.tab-button.active {
    background-color: var(--button-hover-bg-color);
    color: var(--header-text-color);
}

/* --- Tab Content --- */
.tab-content-wrapper {
    background-color: var(--primary-bg-color);
    border: 1px solid var(--input-border-color);
    border-radius: 12px;
    padding: 2rem;
    min-height: 400px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-content h2 {
    color: var(--primary-text-color);
    font-size: 1.8rem;
    margin: 0 0 1.5rem 0;
    font-weight: 700;
}

.tab-content h3 {
    color: var(--primary-text-color);
    font-size: 1.3rem;
    margin: 2rem 0 1rem 0;
    font-weight: 600;
}

/* --- Conversion Table --- */
#conversion-table {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1rem;
}

.conversion-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--input-bg-color);
    border: 1px solid var(--input-border-color);
    border-radius: 8px;
    align-items: center;
}

.conversion-row .label {
    font-weight: 700;
    color: var(--primary-text-color);
    font-size: 0.95rem;
}

.conversion-value-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.conversion-preview {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 2px solid var(--input-border-color);
    flex-shrink: 0;
}

.conversion-row .value {
    font-family: 'Courier New', Courier, monospace;
    color: var(--secondary-text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.95rem;
    background-color: var(--primary-bg-color);
    border: 1px solid var(--input-border-color);
    text-align: center;
    flex: 1;
}

.conversion-row .value:hover {
    background-color: var(--button-hover-bg-color);
    color: var(--header-text-color);
    transform: translateY(-2px);
}

/* --- Color Schemes --- */
.scheme-item {
    margin-bottom: 2.5rem;
}

.scheme-item h3 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
}

.scheme-colors {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.scheme-color {
    flex: 1;
    min-width: 120px;
    height: 120px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--input-border-color);
    position: relative;
    overflow: hidden;
}

.scheme-color:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.scheme-color-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.85rem;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
}

/* --- Shades and Tints --- */
.gradient-palette {
    margin-bottom: 2rem;
}

.gradient-palette-row {
    display: flex;
    width: 100%;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--input-border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gradient-swatch {
    flex: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.gradient-swatch:hover {
    flex: 1.8;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.gradient-swatch::after {
    content: attr(title);
    position: absolute;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: 'Courier New', Courier, monospace;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    white-space: nowrap;
}

.gradient-swatch:hover::after {
    opacity: 1;
}

/* --- Preview --- */
.preview-section {
    margin-bottom: 2rem;
}

.preview-section h3 {
    margin: 0 0 1rem 0;
}

.preview-box {
    padding: 2rem;
    border-radius: 8px;
    border: 2px solid var(--input-border-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.css-code {
    margin-top: 0.5rem;
    padding: 1rem;
    background-color: var(--input-bg-color);
    border-radius: 6px;
    border: 1px solid var(--input-border-color);
}

.css-code code {
    font-family: 'Courier New', Courier, monospace;
    color: var(--primary-text-color);
    font-size: 0.95rem;
}

.css-code-block {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.css-code-block div {
    padding: 1rem;
    background-color: var(--input-bg-color);
    border-radius: 6px;
    border: 1px solid var(--input-border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.css-code-block div:hover {
    background-color: var(--button-hover-bg-color);
    transform: translateX(5px);
}

.css-code-block code {
    font-family: 'Courier New', Courier, monospace;
    color: var(--primary-text-color);
    font-size: 0.95rem;
}

/* --- Blindness Simulator --- */
.blindness-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.blindness-item {
    text-align: center;
    background-color: var(--input-bg-color);
    border: 1px solid var(--input-border-color);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.blindness-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.blindness-item h4 {
    margin: 0 0 0.75rem 0;
    color: var(--primary-text-color);
    font-size: 1rem;
    font-weight: 600;
}

.blindness-swatch {
    width: 100%;
    height: 120px;
    border-radius: 8px;
    border: 2px solid var(--input-border-color);
    margin-bottom: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.blindness-label {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    background-color: var(--primary-bg-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}


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

    #color-form {
        flex-direction: column;
    }

    .input-wrapper {
        width: 100%;
    }

    .color-header-content {
        flex-direction: column;
    }

    .main-swatch {
        width: 100%;
        height: 150px;
    }

    #color-charts {
        flex-direction: column;
    }

    .tab-navigation {
        flex-wrap: wrap;
    }

    #conversion-table {
        grid-template-columns: 1fr;
    }

    .scheme-colors {
        flex-direction: column;
    }

    .scheme-color {
        min-width: 100%;
        height: 100px;
    }
}
