/* Reset en basis styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header styling */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.lang-switch {
    position: absolute;
    top: 20px;
    right: 20px;
}

.lang-dropdown { 
    position: relative; 
}

.lang-current {
    background: rgba(255,255,255,0.9);
    border: 2px solid rgba(255,255,255,0.3);
    color: #667eea;
    font-size: 24px;
    border-radius: 15px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 60px;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.lang-current:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.lang-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 15px;
    padding: 8px;
    display: none;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    margin-top: 8px;
    min-width: 80px;
    z-index: 1000;
}

.lang-dropdown.open .lang-menu { 
    display: block; 
}

.lang-option {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: block;
    padding: 12px 16px;
    width: 100%;
    text-align: center;
    color: #667eea;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s;
}

.lang-option:hover { 
    background: #f8f9ff;
    color: #5a67d8;
}

header h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Generator sectie */
.generator-section {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

.input-section {
    margin-bottom: 30px;
    text-align: center;
}

.input-section label {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #4a5568;
}

.input-container {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

#prompt-input, #iteration-input {
    width: 100%;
    padding: 15px;
    padding-right: 50px;
    border: 3px solid #e2e8f0;
    border-radius: 15px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

h1 img {
    width: 100%;
    max-width: 400px;
    height: auto;
}

.small-buttons {
    background: transparent;
    color: #6b7280;
    border: 2px solid #d1d5db;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0px;
    display: block;
}

.voice-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #f8f9fa;
    border: 2px solid #e2e8f0;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.3s ease;
    font-size: 1.5rem;
}

#voice-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
}

.voice-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
    color: #6b7280;
}

.voice-btn.listening {
    background: #ef4444;
    border-color: #dc2626;
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.1); }
    100% { transform: translateY(-50%) scale(1); }
}

#prompt-input:focus, #iteration-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Upload Section */
.upload-section {
    margin: 20px 0;
}

.upload-label {
    display: block;
    padding: 15px;
    border: 2px dashed #cbd5e0;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f7fafc;
    color: #4a5568;
    font-weight: 500;
}

.upload-label:hover {
    border-color: #667eea;
    background: #edf2f7;
}

.photo-preview {
    position: relative;
    margin-top: 15px;
    text-align: center;
}

.photo-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.remove-photo {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.remove-photo:hover {
    background: #c53030;
}

/* Button styling */
.generate-btn, .iterate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    margin-top: 20px;
    overflow: hidden;
}

.generate-btn:hover, .iterate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.generate-btn:active, .iterate-btn:active {
    transform: translateY(0);
}

/* Button row alignment */
.button-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.button-row .align-right {
    margin-left: auto;
    margin-right: 0;
}


/* Surprise button */
.surprise-btn {
    background: transparent;
    color: #6b7280;
    border: 2px solid #d1d5db;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0px;
    display: block;
}

/* Phosphor icon sizing */
.ph, .ph-bold {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

/* Center icon en tekst verticaal in knoppen */
.btn-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
}

.button-row .generate-btn,
.button-row .surprise-btn,
.gallery-actions button,
.image-overlay .overlay-buttons button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

button i {
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
}

/* Specifieke marge tussen icon en tekst behalve standalone icon-buttons (zoals microfoon) */
.gallery-actions button i,
.image-overlay .overlay-buttons button i {
    margin-right: 8px;
}

/* Space between icons and text in buttons */
.generate-btn .ph, .surprise-btn .ph, .download-btn .ph, .print-btn .ph, .logo-btn .ph {
    margin-right: 6px;
    vertical-align: middle;
}

.surprise-btn:hover, .small-buttons:hover {
    background: transparent;
    color: #6b7280;
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.surprise-btn:active {
    transform: translateY(0);
}

.surprise-btn .spinner {
    border-color: rgba(107, 114, 128, 0.3);
    border-top-color: #6b7280;
}

/* Loading spinner */

/* Counter badge */
.counter-wrap {
    margin-top: 8px;
    color: rgba(255,255,255,0.7);
    padding: 16px 16px 0px;
}
.counter-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,0.4);
    color: #111827;
    border-radius: 9999px;
    padding: 4px 8px;
    min-width: 24px;
    font-weight: 400;
    margin: 0 2px;
    box-shadow: 0 2px 18px rgba(0,0,0,0.15);
    color: rgba(255,255,255,0.85);
}
.counter-badge i {
    color: #10b981; /* groen check icoon */
}
.loading-spinner {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Result sectie */
.result-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e2e8f0;
}

.image-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto 30px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}


.image-container img {
    width: 100%;
    height: auto;
    display: block;
    max-width: 600px;
    margin: 0 auto;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-container:hover .image-overlay {
    opacity: 1;
}

.overlay-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.download-btn, .print-btn {
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
}

.download-btn {
    background: #48bb78;
}

.download-btn:hover {
    background: #38a169;
    transform: scale(1.05);
}

.print-btn {
    background: #667eea;
}

.print-btn:hover {
    background: #5a67d8;
    transform: scale(1.05);
}

/* Logo knop */
.logo-btn {
    background: #3182ce;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
}

.logo-btn:hover {
    background: #2b6cb0;
    transform: scale(1.05);
}

/* Logo modal */
.logo-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1000;
}

.logo-modal.open {
    display: block;
}

.logo-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
}

.logo-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    color: white;
}

.logo-modal-content h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    margin: 0 0 10px 0;
    text-align: center;
}

.logo-modal-content p {
    text-align: center;
    margin: 0 0 25px 0;
    opacity: 0.9;
    font-size: 1rem;
}

.logo-upload {
    margin: 20px 0;
    text-align: center;
}

.logo-upload input[type="file"] {
    background: rgba(255,255,255,0.2);
    border: 2px dashed rgba(255,255,255,0.5);
    border-radius: 15px;
    padding: 20px;
    width: 100%;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logo-upload input[type="file"]:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.7);
}

.logo-preview {
    margin: 20px 0;
    text-align: center;
}

.logo-preview img {
    max-width: 100%;
    max-height: 200px;
    display: block;
    margin: 10px auto;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.logo-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
}

.logo-cancel, .logo-save {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.logo-cancel:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

.logo-save {
    background: #48bb78;
    border-color: #38a169;
}

.logo-save:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
}

/* Gallery / Carousel */
.gallery-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 32px;
}

.carousel {
    position: relative;
    margin: 0 auto 32px auto;
    max-width: 1000px;
}

.carousel-track {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    padding: 6px;
}

.carousel-item {
    flex: 0 0 auto;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    scroll-snap-align: start;
    position: relative;
    background: white;
    cursor: pointer;
}

.carousel-item.active {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.2);
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.thumb-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.9);
    border: 2px solid #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #e53e3e;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.thumb-delete:hover {
    border-color: #e53e3e;
}

.carousel-nav { display: none; }

/* Snackbar */
.snackbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.snackbar.show {
    opacity: 1;
    visibility: visible;
}

.snackbar.error {
    background: #e53e3e;
}

.snackbar.success {
    background: #38a169;
}

.snackbar.warning {
    background: #d69e2e;
}

/* Iteratie sectie */
.iteration-section {
    background: #f7fafc;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid #e2e8f0;
}

.iteration-section h3 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

/* Voorbeelden sectie */
.examples-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.examples-section h3 {
    color: #4a5568;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3rem;
}

.example-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.example-tag {
    background: transparent;
    color: #667eea;
    padding: 12px 24px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    border: 2px solid #667eea;
    font-size: 1rem;
}

.example-tag:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    color: white;
    opacity: 0.8;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    .button-row {
        flex-direction: column;
        align-items: stretch;
    }
    .button-row .align-right {
        margin-left: 0;
    }
    .generate-btn, .surprise-btn {
        width: 100%;
    }

    .small-buttons i {
        display: none;
    }

    .gallery-actions {
        gap: 6px;
    }
    
    header h1 {
        font-size: 2.5rem;
    }
    
    .generator-section {
        padding: 25px;
    }
    
    .example-tags {
        justify-content: flex-start;
    }

    .examples-section {
        padding: 16px;
    }
    
    .example-tag {
        font-size: 0.9rem;
        padding: 10px 20px;
        flex: 0 0 calc(50% - 5px);
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
    }
    .carousel-track {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 2rem;
    }
    
    .generator-section {
        padding: 16px;
    }
    
    .generate-btn, .iterate-btn {
        width: 100%;
        padding: 18px;
    }
}
