* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    color: white;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.header-controls {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 10px;
}

.lang-selector {
    position: relative;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.lang-btn:hover {
    background: rgba(253, 187, 45, 0.7);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 10px 0;
    margin-top: 5px;
    min-width: 120px;
    display: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.lang-dropdown.active {
    display: block;
}

.lang-option {
    padding: 8px 15px;
    cursor: pointer;
    color: #333;
    transition: all 0.3s ease;
}

.lang-option:hover {
    background: rgba(253, 187, 45, 0.3);
}

.help-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.help-btn:hover {
    background: rgba(253, 187, 45, 0.7);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.main-content {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
}

.controls {
    flex: 1;
    min-width: 350px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.preview {
    flex: 1;
    min-width: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 10px;
}

.search-container {
    position: relative;
    margin-bottom: 20px;
}

.search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border-radius: 25px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1rem;
    backdrop-filter: blur(5px);
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.7);
}

.filter-container {
    position: relative;
    margin-bottom: 20px;
}

.filter-main-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.filter-scroll-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.filter-scroll-arrow {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.filter-scroll-arrow:hover {
    background: rgba(253, 187, 45, 0.7);
}

.filter-scroll-arrow.left {
    margin-right: 10px;
}

.filter-scroll-arrow.right {
    margin-left: 10px;
}

.filter-controls {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 5px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filter-controls::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-btn.active {
    background: #fdbb2d;
    color: #1a2a6c;
    font-weight: bold;
}

.filter-btn:hover {
    background: rgba(253, 187, 45, 0.7);
}

.deselect-all {
    background: rgba(178, 31, 31, 0.7);
    flex-shrink: 0;
}

.deselect-all:hover {
    background: rgba(178, 31, 31, 0.9);
}

.frame-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.frame-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.frame-option:hover {
    transform: scale(1.05);
}

.frame-option.selected {
    border-color: #fdbb2d;
    box-shadow: 0 0 15px rgba(253, 187, 45, 0.7);
}

.frame-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.frame-theme {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.7rem;
    padding: 3px;
    text-align: center;
}

.upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    margin-bottom: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    background: rgba(255, 255, 255, 0.1);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.image-controls {
    margin-top: 20px;
    display: none;
    width: 100%;
}

.image-controls.active {
    display: block;
}

.position-sliders {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.slider-container {
    margin-bottom: 15px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fdbb2d;
    cursor: pointer;
}

.transform-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.transform-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
}

.transform-btn:hover {
    background: rgba(253, 187, 45, 0.7);
}

.preview-container {
    width: 300px;
    height: 300px;
    position: relative;
    margin-bottom: 30px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

#previewCanvas {
    width: 100%;
    height: 100%;
}

.download-btn {
    background: linear-gradient(to right, #fdbb2d, #b21f1f);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 25px;
}

.download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.download-btn:active {
    transform: translateY(1px);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f);
    border-radius: 15px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 1.5rem;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    position: absolute;
    top: 6px;
    right: 10px;
}

.instructions ol {
    padding-left: 20px;
}

.instructions li {
    margin-bottom: 10px;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .preview-container {
        width: 250px;
        height: 250px;
    }

    .filter-scroll-arrow {
        display: none;
    }

    .header-controls {
        position: static;
        justify-content: center;
        margin-bottom: 15px;
    }
}

.frame-theme a {
    text-decoration: none;
    color: white;
    display: inline-block;
    padding-right: 24px;
}

.frame-theme a:hover {
    color: #ff0000; /* le SVG suivra */
}

.frame-theme a::after {
    content: "";
    display: inline-block;
    width: 13px;
    height: 13px;
    position: absolute;
    right: 2px;
    top: 2px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M15 3h6v6'/><path d='M10 14 21 3'/><path d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/></svg>");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}