/* ============================================
   Allgemeine Stile
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    padding: 1.5rem;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
    width: 100%;
    margin: 0 auto;
}

/* ============================================
   Container
   ============================================ */
.container {
    max-width: 1400px;
    margin: 2rem auto 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* ============================================
   Header
   ============================================ */
header {
    background: linear-gradient(135deg, #0066cc, #003366);
    color: #fff;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ============================================
   Main
   ============================================ */
main {
    padding: 2rem;
}

/* ============================================
   Grid Layout
   ============================================ */
.grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.input-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

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

/* ============================================
   Sections
   ============================================ */
.input-section,
.preview-section,
.download-section,
.info-section {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #e0e0e0;
}

.input-section h2,
.preview-section h2,
.download-section h2,
.info-section h2 {
    font-size: 1.3rem;
    color: #003366;
    font-weight: 500;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #0066cc;
}

/* ============================================
   Form Elements
   ============================================ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #003366;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 5px rgba(0, 102, 204, 0.3);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.form-control-small {
    width: 80px;
    padding: 0.5rem;
    font-size: 0.85rem;
}

.form-control-color {
    height: 45px;
    padding: 2px;
    cursor: pointer;
}

.form-range {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #0066cc, #0066cc);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0066cc;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 102, 204, 0.4);
}

.form-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0066cc;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 102, 204, 0.4);
}

.input-with-range {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.opacity-label {
    font-weight: 500;
    color: #666;
    min-width: 30px;
}

.help-text {
    display: block;
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
    margin-top: 0.25rem;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.3s, transform 0.2s, box-shadow 0.3s;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #0066cc, #003366);
    color: #fff;
    width: 100%;
    margin-bottom: 0.75rem;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #ff6600, #ff3300);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: #dc3545;
    color: #fff;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: #c82333;
}

.preset-btn {
    background: #fff;
    border: 2px solid #ddd;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.preset-btn:hover {
    border-color: #0066cc;
    background: #f0f7ff;
}

.preset-btn.active {
    border-color: #0066cc;
    background: #0066cc;
    color: #fff;
}

.preset-preview {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid #999;
}

.preset-preview.default {
    background: #000;
}

.preset-preview.inverse {
    background: #fff;
    border: 1px solid #000;
}

.preset-preview.blue {
    background: #0066cc;
}

.preset-preview.red {
    background: #dc3545;
}

.preset-preview.green {
    background: #28a745;
}

/* ============================================
   Color Inputs
   ============================================ */
.color-presets {
    margin-bottom: 1rem;
}

.color-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.color-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.color-input-group label {
    font-size: 0.9rem;
}

.color-input-group input[type="color"] {
    margin-bottom: 0.25rem;
}

/* ============================================
   File Input
   ============================================ */
.file-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.file-input-wrapper input[type="file"] {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.file-name {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
}

/* ============================================
   QR Preview
   ============================================ */
.qr-preview-container {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

#qr-code {
    max-width: 100%;
    display: inline-block;
}

#qr-code img,
#qr-code svg {
    max-width: 300px;
    height: auto;
}

.preview-info {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
}

/* ============================================
   Download Buttons
   ============================================ */
.download-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.download-options {
    background: #fff;
    padding: 1rem;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
}

.download-options .form-group {
    margin-bottom: 0.75rem;
}

/* ============================================
   Info Box
   ============================================ */
.info-box {
    background: #e6f2ff;
    border-left: 4px solid #0066cc;
    padding: 1rem;
    border-radius: 5px;
}

.info-box p {
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.info-box p:last-child {
    margin-bottom: 0;
}

/* ============================================
   Error Message
   ============================================ */
.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 0.75rem 1rem;
    border-radius: 5px;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.error-message.hidden {
    display: none;
}

/* ============================================
   Hidden
   ============================================ */
.hidden {
    display: none !important;
}

.template-content {
    display: none;
}

.template-content.active {
    display: block;
}

/* ============================================
   Footer
   ============================================ */
footer {
    background: #f0f2f5;
    padding: 2rem 1.5rem;
    margin-top: 3rem;
    border-top: 1px solid #ddd;
    text-align: center;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
}

footer p {
    margin: 0.75rem 0;
    color: #666;
    font-size: 0.95rem;
    line-height: 1.8;
}

footer .small {
    font-size: 0.85rem;
    color: #888;
}

footer a {
    color: #0066cc;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

footer a:hover {
    color: #ff6600;
    text-decoration: underline;
}

/* ============================================
   QR Tooltip (am Ende vor Responsive einfügen)
   ============================================ */
.qr-preview-container {
    position: relative; /* Wichtig für absolute Positionierung des Tooltips */
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    cursor: help; /* Zeigt an, dass Hover-Info verfügbar ist */
}

.qr-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 10px;
    background: #2c3e50;
    color: #ecf0f1;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    min-width: 300px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.qr-tooltip.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(-5px);
}

.qr-tooltip.hidden {
    display: none;
}

.tooltip-header {
    background: #34495e;
    padding: 0.75rem 1rem;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 2px solid #0066cc;
}

.qr-tooltip pre {
    margin: 0;
    padding: 1rem;
    background: #2c3e50;
    color: #2ecc71;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    border-radius: 0 0 8px 8px;
}

/* Scrollbar für Tooltip */
.qr-tooltip pre::-webkit-scrollbar {
    width: 8px;
}

.qr-tooltip pre::-webkit-scrollbar-track {
    background: #34495e;
    border-radius: 0 0 8px 0;
}

.qr-tooltip pre::-webkit-scrollbar-thumb {
    background: #0066cc;
    border-radius: 4px;
}

.qr-tooltip pre::-webkit-scrollbar-thumb:hover {
    background: #0052a3;
}

/* Pfeil nach unten */
.qr-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 10px solid transparent;
    border-top-color: #2c3e50;
}

/* Responsive Anpassungen für Tooltip */
@media (max-width: 768px) {
    .qr-tooltip {
        max-width: 90vw;
        min-width: 250px;
        font-size: 0.8rem;
    }
    
    .qr-tooltip pre {
        font-size: 0.75rem;
        max-height: 200px;
    }
}


/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .grid-container {
        grid-template-columns: 1fr;
    }

    .color-inputs {
        grid-template-columns: 1fr;
    }

    .download-buttons {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .container {
        max-width: 100%;
        margin-top: 0;
        border-radius: 0;
    }

    header h1 {
        font-size: 1.8rem;
    }

    main {
        padding: 1.5rem;
    }

    .input-section,
    .preview-section,
    .download-section,
    .info-section {
        padding: 1rem;
    }

    .input-section h2,
    .preview-section h2,
    .download-section h2,
    .info-section h2 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    .form-control-small {
        width: 100%;
    }

    .input-with-range {
        flex-direction: column;
        align-items: stretch;
    }

    .form-range {
        width: 100%;
    }

    .opacity-label {
        text-align: right;
    }

    footer {
        padding: 1.5rem 1rem;
        margin-top: 2rem;
    }

    footer p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.5rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    main {
        padding: 1rem;
    }

    .input-section,
    .preview-section,
    .download-section,
    .info-section {
        padding: 0.75rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .form-control {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    textarea.form-control {
        min-height: 80px;
    }

    .preset-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
        margin-right: 0.25rem;
    }

    .preset-preview {
        width: 16px;
        height: 16px;
    }

    .qr-preview-container {
        min-height: 250px;
        padding: 1rem;
    }

    #qr-code img,
    #qr-code svg {
        max-width: 200px;
    }

    .download-buttons {
        grid-template-columns: 1fr;
    }

    .color-inputs {
        grid-template-columns: 1fr;
    }

    footer {
        padding: 1rem 0.5rem;
        margin-top: 1.5rem;
    }

    footer p {
        font-size: 0.8rem;
        margin: 0.5rem 0;
    }
}
