/* css/style.css */

/* --- Globale Einstellungen --- */
body {
    background-color: #F5F5F5;
    padding-bottom: 4rem;
}

/* --- Farb-Swatches (Kacheln) --- */
.color-swatch {
    width: 80px;
    height: 80px;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    display: inline-block;
    margin: 0.5rem;
    cursor: pointer;
    position: relative;
    transition: box-shadow 0.3s ease, border-color 0.3s ease; /* Transition für Border hinzugefügt */
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
}

.color-swatch:hover {
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
}

/* NEU: Warnung bei schlechtem Kontrast */
.color-swatch.contrast-fail {
    border-color: #ef4444 !important;
    border-width: 2px;
}

.color-preview {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 0.5rem;
}

.color-preview input[type="color"] {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.color-code {
    font-family: monospace;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    text-align: center;
}

.color-code-input {
    font-family: monospace;
    font-size: 0.875rem;
    width: 80px;
    text-align: center;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    padding: 0.1rem;
    margin-top: 0.25rem;
    background-color: #ffffff;
}

.color-code-input:focus {
    outline: none;
    border-color: #6b7280;
    box-shadow: 0 0 0 2px rgba(107, 114, 128, 0.2);
}

.color-code-input.error {
    border-color: #ef4444;
}

/* --- Vorschau-Bereich (Bild & Text) --- */
#preview {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

#previewWrapper {
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #E0E0E0;
    margin-top: 0.5rem;
    text-align: center;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#previewWrapper h2 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    color: inherit;
}

#previewWrapper p {
    margin: 0;
    font-size: 1rem;
    color: inherit;
}

#swatches {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 1rem;
}

/* --- Utility Klassen --- */
#previewContainer.hidden,
#preview.hidden,
.hidden {
    display: none;
}

/* --- UI Komponenten --- */
#titleBar {
    padding: 1rem;
    border-radius: 0.5rem 0.5rem 0 0;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#titleBar h1 {
    color: inherit;
}

#inputContainer {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

#termSection,
#imageSection {
    flex: 1;
    padding: 0.5rem;
    border-radius: 0.5rem;
}

#termSection {
    position: relative;
}

#termSection label,
#termSection input[type="text"],
#imageSection label {
    color: inherit;
}

#termSection label,
#imageSection label {
    margin-bottom: 0.25rem;
}

/* --- Drag & Drop Area --- */
#dropArea {
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    height: 2.5rem;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s ease, background-color 0.3s ease;
    flex: 1;
}

#dropArea.dragover {
    border-color: #6b7280;
    background-color: #f3f4f6;
}

#dropArea p {
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
    white-space: nowrap;
}

#imageInput {
    display: none;
}

/* --- Auto-Suggest --- */
#suggestions {
    position: absolute;
    width: calc(100% - 1rem);
    max-height: 200px;
    overflow-y: auto;
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
    display: none;
    color: #000000 !important;
    left: 0.5rem;
    top: calc(100% - 1.25rem);
}

#suggestions div {
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: #000000 !important;
}

#suggestions div:hover {
    background-color: #f3f4f6;
}

#termInput,
#generateButton {
    height: 2.5rem;
    line-height: 2.5rem;
}

#termInput {
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    background-color: #ffffff !important;
    color: #000000 !important;
}

#termInput:focus {
    border-color: #000000;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

#generateButton {
    padding-top: 0;
    padding-bottom: 0;
}

/* --- Sliders --- */
#sliderContainer {
    margin-top: 1rem;
    text-align: center;
    position: relative;
}

.slider-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    position: relative;
}

.harmony-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.harmony-label {
    width: 120px;
    text-align: right;
    padding-right: 1rem;
    font-size: 0.875rem;
    color: #6b7280;
    flex-shrink: 0;
}

.slider-label {
    width: 80px;
    text-align: right;
    padding-right: 1rem;
    font-size: 0.875rem;
    color: #6b7280;
    flex-shrink: 0;
}

.slider-label-right {
    width: 80px;
    text-align: left;
    padding-left: 1rem;
    font-size: 0.875rem;
    color: #6b7280;
    flex-shrink: 0;
}

.slider-track {
    width: 40%;
    position: relative;
    flex-shrink: 1;
}

#toneSlider,
#saturationSlider,
#brightnessSlider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 5px;
    outline: none;
    opacity: 0.9;
    transition: opacity 0.2s;
    cursor: pointer;
}

#toneSlider {
    background: linear-gradient(to right, #f4c7c3 0%, #ffffff 50%, #00f7ff 100%);
}

#saturationSlider {
    background: linear-gradient(to right, #808080 0%, #ff0000 50%, #ff5555 100%);
}

#brightnessSlider {
    background: linear-gradient(to right, #000000 0%, #ffffff 50%, #ffffff 100%);
}

#toneSlider:hover,
#saturationSlider:hover,
#brightnessSlider:hover {
    opacity: 1;
}

#toneSlider::-webkit-slider-thumb,
#saturationSlider::-webkit-slider-thumb,
#brightnessSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--slider-thumb-bg);
    border: 2px solid var(--slider-thumb-border);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#toneSlider::-moz-range-thumb,
#saturationSlider::-moz-range-thumb,
#brightnessSlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--slider-thumb-bg);
    border: 2px solid var(--slider-thumb-border);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-tooltip {
    position: absolute;
    background-color: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    transform: translateX(-50%);
    display: none;
    z-index: 10;
    top: -30px;
    pointer-events: none;
}

.slider-tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.contrast-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: bold;
    text-align: center;
    white-space: nowrap;
    z-index: 2;
    pointer-events: none;
}

/* --- Image Section Icons --- */
#imageSectionWrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#clipboardIcon {
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

#clipboardIcon svg {
    width: 1.5rem;
    height: 1.5rem;
}

#clipboardTooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    display: none;
    z-index: 10;
    margin-bottom: 5px;
}

#clipboardTooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

#clipboardIcon:hover #clipboardTooltip {
    display: block;
}

/* --- Share Button --- */
#shareButton {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: filter 0.3s ease;
}

#shareButton:hover {
    filter: brightness(110%);
}

#shareButton svg {
    width: 20px;
    height: 20px;
}

#shareTooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    display: none;
    z-index: 10;
    margin-bottom: 5px;
}

#shareTooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

#shareButton:hover #shareTooltip {
    display: block;
}

#debugOutput {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f0f0f0;
    border-radius: 0.5rem;
    font-family: monospace;
    font-size: 0.875rem;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    display: none;
}

#harmonySelect {
    width: 40%;
    padding: 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid #e5e7eb;
    background-color: #ffffff;
    height: 2.5rem;
    line-height: 1.5rem;
}

#harmonySelect:focus {
    outline: none;
    border-color: #6b7280;
    box-shadow: 0 0 0 2px rgba(107, 114, 128, 0.2);
}

:root {
    --slider-thumb-bg: #ffffff;
    --slider-thumb-border: #616161;
    --incms-primary: #616161;
}

/* --- Theme Previews --- */
#themePreviewsContainer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

#themePreviewsGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.theme-preview-box {
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 1.5rem;
    transition: background-color 0.3s ease, color 0.3s ease;
    position: relative;
    overflow: hidden;
}

.theme-preview-box::before {
    content: attr(data-theme-name);
    position: absolute;
    top: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-bottom-right-radius: 0.5rem;
    color: inherit;
    opacity: 0.8;
}

.theme-preview-box h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: inherit;
}

.theme-preview-box p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    color: inherit;
    opacity: 0.9;
}

.theme-preview-box .button-container {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.preview-button {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.preview-button:hover {
    opacity: 0.85;
}

.preview-button-secondary {
    background-color: transparent;
}

/* --- Toggle Switch Styles --- */
.mode-toggle-row .slider-label,
.mode-toggle-row .slider-label-right {
    line-height: 26px;
    flex-shrink: 0;
}

.toggle-switch-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40%;
    flex-shrink: 1;
    min-height: 2.5rem;
}

.toggle-switch-checkbox {
    height: 0;
    width: 0;
    visibility: hidden;
    position: absolute;
}

.toggle-switch-label {
    cursor: pointer;
    width: 50px;
    height: 26px;
    background: #6b7280; /* Dunkelgrau für "Dunkel" (unchecked) */
    display: block;
    border-radius: 100px;
    position: relative;
    transition: background-color 0.2s ease;
}

.toggle-switch-label::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s ease;
}

.toggle-switch-checkbox:checked + .toggle-switch-label {
    background: #D1D5DB; /* Hellgrau für "Hell" (checked) */
}

.toggle-switch-checkbox:checked + .toggle-switch-label::after {
    left: calc(100% - 3px);
    transform: translateX(-100%);
}

.toggle-switch-label:active:after {
    width: 24px;
}