@font-face {
    font-family: 'Lavishly Yours';
    src: url('fonts/Lavishly_Yours/LavishlyYours-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Bonheur Royale';
    src: url('fonts/Bonheur_Royale/BonheurRoyale-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Italianno';
    src: url('fonts/Italianno/Italianno-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --success-color: #10b981;
    --success-hover: #059669;
    --secondary-color: #6b7280;
    --secondary-hover: #4b5563;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --spacing: 1rem;
    --border-radius: 0.75rem;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    padding: var(--spacing);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 0;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

section {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

/* Upload Bereich */
.upload-section {
    padding: 2rem;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-color);
    touch-action: manipulation;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f0f0ff;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: #e0e0ff;
    transform: scale(1.02);
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    color: var(--primary-color);
    margin: 0 auto 1rem;
    display: block;
}

.upload-text {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.image-preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: move;
    transition: transform 0.2s ease, opacity 0.2s ease;
    user-select: none;
}

.image-preview-item:hover {
    transform: scale(1.05);
}

.image-preview-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.image-preview-item.drag-over {
    border: 2px solid var(--primary-color);
    transform: scale(1.1);
    z-index: 10;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item .remove-btn {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.2s ease;
    touch-action: manipulation;
    z-index: 20;
    pointer-events: auto;
}

.image-preview-item .remove-btn:hover {
    background: rgba(220, 38, 38, 1);
}


/* Einstellungen */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-group label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.setting-control {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    touch-action: manipulation;
}

.setting-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

.color-input {
    width: 100%;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    touch-action: manipulation;
}

.number-input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    width: 100%;
}

/* Text Bereich */
.text-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.text-section h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.text-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.text-line-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.text-line-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.text-line-settings {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.font-select {
    flex: 1;
    min-width: 150px;
}

.slider-container-small {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 120px;
}

.text-input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    width: 100%;
}

.text-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.text-settings {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.color-input-small {
    width: 50px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    touch-action: manipulation;
}

.slider-small {
    flex: 1;
    min-width: 100px;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.slider-small::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.slider-small::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

.setting-control-small {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    touch-action: manipulation;
}

/* Vorschau */
.preview-section h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.variant-navigation {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.btn-icon:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.variant-info {
    font-weight: 500;
    color: var(--text-primary);
    min-width: 50px;
    text-align: center;
}

.preview-container {
    background: var(--bg-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    overflow: auto;
}

#previewCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    background: white;
}

.preview-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    min-width: 140px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: var(--success-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        margin-bottom: 0;
    }

    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }
    
    /* Schatten auf mobilen Geräten entfernen für aufgeräumteres Design */
    section {
        box-shadow: none;
    }
    
    .image-preview-item {
        box-shadow: none;
    }
    
    #previewCanvas {
        box-shadow: none;
    }
    
    .btn:hover:not(:disabled) {
        box-shadow: none;
        transform: none;
    }

    section {
        padding: 1rem;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .settings-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .text-settings {
        flex-direction: column;
        align-items: stretch;
    }

    .slider-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .preview-header {
        flex-direction: column;
        align-items: center;
    }

    .variant-navigation {
        align-self: center;
    }

    .preview-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .image-preview-container {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.5rem;
        background: white; /* Weißer Hintergrund auf mobilen Geräten */
    }
    
    .container {
        background: white;
    }

    header {
        padding: 1rem 0;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .upload-area {
        padding: 1.5rem 0.75rem;
    }

    .upload-text {
        font-size: 1rem;
    }
    
    /* Alle Schatten entfernen für aufgeräumteres Design */
    section {
        box-shadow: none;
        background: white;
    }
    
    .image-preview-item {
        box-shadow: none;
    }
    
    #previewCanvas {
        box-shadow: none;
    }
    
    .btn:hover:not(:disabled) {
        box-shadow: none;
        transform: none;
    }
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
}
