@font-face {
    font-family: 'CAMagicHour-Regular';
    src: url('CAMagicHour-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: #000000;
    color: #ffffff;
    overflow: hidden;
    font-size: 12px;
}

.container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.controls-panel {
    width: 260px;
    padding: 16px 16px;
    background: #111111;
    border-right: 1px solid #1a1a1a;
    overflow-y: auto;
}

.control-group {
    margin-bottom: 12px;
}

.control-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    color: #888888;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.control-group label span {
    float: right;
    color: #ffffff;
    font-weight: 500;
}

.control-group input[type="range"] {
    width: 100%;
    height: 4px;
    background: #1a1a1a;
    outline: none;
    border-radius: 2px;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    background: #ffffff;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.1s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 10px;
    height: 10px;
    background: #ffffff;
    cursor: pointer;
    border-radius: 50%;
    border: none;
    transition: transform 0.1s ease;
}

.control-group input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.15);
}

.control-group input[type="text"] {
    width: 100%;
    padding: 6px 10px;
    background: #1a1a1a;
    border: 1px solid #1a1a1a;
    border-radius: 3px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    transition: border-color 0.2s ease;
}

.multi-text-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.multi-text-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.multi-text-row .line-text-input {
    flex: 1;
    min-width: 0;
}

.remove-text-btn {
    width: 28px;
    height: 28px;
    border-radius: 3px;
    border: 1px solid #2a2a2a;
    background: #1a1a1a;
    color: #777777;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.remove-text-btn:hover:not(:disabled) {
    background: #222222;
    border-color: #444444;
    color: #ffffff;
}

.remove-text-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.multi-text-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.small-button {
    padding: 6px 10px;
    border-radius: 3px;
    border: 1px solid #333333;
    background: #1a1a1a;
    color: #ffffff;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.small-button:hover:not(:disabled) {
    background: #222222;
    border-color: #555555;
}

.small-button:disabled {
    opacity: 0.4;
    cursor: default;
}

.multi-text-help {
    flex: 1;
    text-align: right;
    font-size: 10px;
    color: #666666;
}

.control-group input[type="text"]:focus {
    outline: none;
    border-color: #333333;
}

.control-group input[type="color"] {
    width: 100%;
    height: 28px;
    border: 1px solid #1a1a1a;
    border-radius: 3px;
    cursor: pointer;
    -webkit-appearance: none;
    background: #1a1a1a;
}

.control-group input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 4px;
}

.control-group select {
    width: 100%;
    padding: 6px 10px;
    background: #1a1a1a;
    border: 1px solid #1a1a1a;
    border-radius: 3px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.control-group select:focus {
    outline: none;
    border-color: #333333;
}

.control-group select option {
    background: #1a1a1a;
    color: #ffffff;
}

.canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000000;
    position: relative;
    overflow: hidden;
}

#glCanvas {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.canvas-container canvas:not(#glCanvas) {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0;
}

/* Scrollbar styling */
.controls-panel::-webkit-scrollbar {
    width: 6px;
}

.controls-panel::-webkit-scrollbar-track {
    background: transparent;
}

.controls-panel::-webkit-scrollbar-thumb {
    background: #333333;
    border-radius: 3px;
}

.controls-panel::-webkit-scrollbar-thumb:hover {
    background: #444444;
}

.reset-button {
    width: 100%;
    padding: 8px 12px;
    background: #333333;
    border: none;
    border-radius: 3px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 8px;
}

.reset-button:hover {
    background: #444444;
    transform: translateY(-1px);
}

.reset-button:active {
    transform: translateY(0);
}

.export-button {
    width: 100%;
    padding: 8px 12px;
    background: #ffffff;
    border: none;
    border-radius: 3px;
    color: #000000;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.export-button:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}

.export-button:active {
    transform: translateY(0);
}

.export-button:disabled {
    background: #666666;
    cursor: not-allowed;
    transform: none;
}

/* Styles pour l'éditeur de gradient */
.gradient-editor-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.gradient-editor-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Modal */
.gradient-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.gradient-modal-content {
    background: #1a1a1a;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
}

.gradient-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #333;
}

.gradient-modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #333;
    color: #fff;
}

.gradient-modal-body {
    padding: 24px;
}

.gradient-editor {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.gradient-preview {
    width: 100%;
    height: 60px;
    border-radius: 8px;
    border: 1px solid #333;
    background: linear-gradient(to right, #000000, #ffffff);
    position: relative;
    overflow: hidden;
}

.gradient-stops {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.gradient-stop {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: #222;
    border-radius: 6px;
    border: 1px solid #333;
}

.gradient-stop-color {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    border: 2px solid #444;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gradient-stop-color:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.gradient-stop-position {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gradient-stop-position input[type="range"] {
    flex: 1;
    height: 4px;
    background: #333;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.gradient-stop-position input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.gradient-stop-position input[type="number"] {
    width: 60px;
    background: #333;
    border: 1px solid #444;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.gradient-stop-remove {
    background: #ff4757;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

.gradient-stop-remove:hover {
    background: #ff3742;
    transform: scale(1.1);
}

.gradient-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-small {
    background: #333;
    color: #fff;
    border: 1px solid #444;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.btn-small:hover {
    background: #444;
    border-color: #555;
}

.gradient-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 24px;
    border-top: 1px solid #333;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #333;
    color: #fff;
    border: 1px solid #444;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #444;
    border-color: #555;
}

/* Masquer les sélecteurs de couleur quand motion blur est actif */
#textColorGroup.hidden,
#backgroundColorGroup.hidden {
    display: none;
}
