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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

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

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.editor-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

section {
    margin-bottom: 30px;
}

section h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.5em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #888;
    font-size: 0.85em;
}

.form-group small a {
    color: #667eea;
    text-decoration: none;
}

.form-group small a:hover {
    text-decoration: underline;
}

/* AI Section */
.ai-section {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #667eea30;
}

.ai-section h2 {
    border-bottom-color: #8b5cf6;
}

.ai-description {
    margin-bottom: 15px;
    color: #555;
    line-height: 1.6;
}

.ai-description small {
    color: #10b981;
    font-weight: 500;
}

.btn-ai {
    width: 100%;
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #8b5cf6 0%, #667eea 100%);
    color: white;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    margin-top: 15px;
}

.btn-ai:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-ai:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ai-status {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.95em;
    display: none;
}

.ai-status.show {
    display: block;
}

.ai-status.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.ai-status.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.ai-status.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
}

.ai-loading {
    display: none;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 12px;
    background: #f3f4f6;
    border-radius: 8px;
    color: #667eea;
    font-weight: 500;
}

.ai-loading.show {
    display: flex;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Note Palette */
.selection-group {
    margin-bottom: 25px;
}

.selection-group h3 {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 12px;
    font-weight: 500;
}

.note-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.color-btn {
    width: 70px;
    height: 70px;
    border: 3px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.color-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.color-btn.selected {
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.4);
    transform: scale(1.05);
}

.finger-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.finger-btn {
    width: 90px;
    height: 80px;
    border: 3px solid #ddd;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.finger-btn small {
    font-size: 0.4em;
    font-weight: normal;
    color: #666;
    margin-top: 4px;
}

.finger-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-2px);
}

.finger-btn.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.finger-btn.selected small {
    color: white;
}

.current-selection {
    background: #f9fafb;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.current-selection p {
    margin-bottom: 12px;
    color: #555;
    font-size: 1.05em;
}

#selectionDisplay {
    font-weight: bold;
    color: #667eea;
}

.btn-add-note {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-note:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

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

/* Note Colors (8-note octave) */
.rose {
    background-color: #ff6b9d; /* Do (C) */
}

.vert {
    background-color: #4ade80; /* Ré (D) */
}

.bleu {
    background-color: #60a5fa; /* Mi (E) */
}

.jaune {
    background-color: #fbbf24; /* Fa (F) */
}

.orange {
    background-color: #fb923c; /* Sol (G) */
}

.violet {
    background-color: #a78bfa; /* La (A) */
}

.cyan {
    background-color: #22d3ee; /* Si (B) */
}

.magenta {
    background-color: #ec4899; /* Do aigu (C) */
}

.note-legend {
    text-align: center;
    margin-bottom: 10px;
    color: #666;
    font-size: 0.9em;
}

/* Controls */
.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-control {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background-color: #667eea;
    color: white;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-control:hover {
    background-color: #5568d3;
}

.btn-control.danger {
    background-color: #ef4444;
}

.btn-control.danger:hover {
    background-color: #dc2626;
}

/* Preview Section */
.partition-preview {
    background: #f9fafb;
    border-radius: 12px;
    padding: 30px;
    min-height: 200px;
}

.partition-header {
    text-align: center;
    margin-bottom: 30px;
}

.partition-header h3 {
    font-size: 2em;
    color: #333;
    margin-bottom: 5px;
}

.partition-header p {
    color: #666;
    font-size: 1.2em;
}

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

.part-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.note {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 1.5em;
    font-weight: bold;
    color: white;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
}

.note:hover {
    transform: scale(1.05);
}

/* Export Section */
.export-section {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-export {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    background-color: #10b981;
    color: white;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: 500;
}

.btn-export:hover {
    background-color: #059669;
}

.copy-message {
    color: #10b981;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s;
}

.copy-message.show {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }

    .note-btn {
        width: 60px;
        height: 60px;
        font-size: 1.5em;
    }

    .note {
        width: 50px;
        height: 50px;
        font-size: 1.3em;
    }

    .editor-container {
        padding: 20px;
    }
}
