/* ==========================================
   RAINBOW HANDBELLS TRHB 20 - STYLESHEET
   ========================================== */

:root {
    /* 20 Chromatic Bell Colors */
    --c2-red: #FF0000;
    --cs2-red-orange: #FF4500;
    --d2-orange: #FF8C00;
    --ds2-orange-yellow: #FFB600;
    --e2-yellow: #FFD700;
    --f2-yellow-green: #9ACD32;
    --fs2-green: #32CD32;
    --g2-green-cyan: #00CED1;
    --gs2-cyan: #00BFFF;
    --a2-cyan-blue: #1E90FF;
    --as2-blue: #4169E1;
    --b2-blue-purple: #6A5ACD;
    
    --c3-purple: #8B00FF;
    --cs3-purple-pink: #9932CC;
    --d3-pink: #BA55D3;
    --ds3-pink-rose: #DA70D6;
    --e3-rose: #FF69B4;
    --f3-hot-pink: #FF1493;
    --fs3-tomato: #FF6347;
    --g3-orange-red: #FF4500;
    
    /* UI Colors */
    --bg-color: #f4f4f9;
    --text-color: #333;
    --card-bg: white;
    --shadow: rgba(0,0,0,0.1);
    --border-color: #ddd;
    --primary-color: #333;
    --primary-hover: #555;
    
    /* Piano Keys */
    --key-white: #ffffff;
    --key-black: #333333;
    --key-active: #eaeaea;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* ==========================================
   HEADER
   ========================================== */

header {
    background: linear-gradient(90deg, 
        var(--c2-red), 
        var(--e2-yellow), 
        var(--g2-green-cyan), 
        var(--b2-blue-purple),
        var(--f3-hot-pink)
    );
    color: white;
    padding: 2rem 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px var(--shadow);
    text-align: center;
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    margin: 0.5rem 0 0 0;
    font-size: 1.1rem;
    opacity: 0.95;
    background: rgba(0,0,0,0.2);
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
}

/* ==========================================
   CONTAINER & CARDS
   ========================================== */

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem 2rem 1rem;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.card h2 {
    color: #444;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.8rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.card p {
    color: #666;
    margin-bottom: 1.5rem;
}

/* ==========================================
   TUNER / DETECTION SECTION
   ========================================== */

#note-display {
    font-size: 5rem;
    font-weight: bold;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
    color: #ccc;
    transition: color 0.1s, transform 0.1s;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

#note-display.detected {
    animation: pulse 0.1s ease-in-out;
}

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

#freq-display {
    font-family: 'Courier New', monospace;
    color: #888;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.note-info {
    text-align: center;
    font-style: italic;
    color: #999;
    margin-bottom: 1rem;
    height: 1.5rem;
}

.status-line {
    margin-top: 10px;
    font-size: 0.9rem;
    text-align: center;
}

.status-dot {
    height: 10px;
    width: 10px;
    background-color: #ccc;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    transition: all 0.3s;
}

.status-active {
    background-color: #4cd964;
    box-shadow: 0 0 8px #4cd964;
}

.visualizer-bar {
    width: 100%;
    height: 24px;
    background: #eee;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 10px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.visualizer-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--a2-cyan-blue), var(--g2-green-cyan));
    transition: width 0.05s;
}

.recording-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

#recording-status {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #666;
    min-height: 20px;
}

#recording-status.active {
    color: var(--c2-red);
    font-weight: bold;
    animation: blink 1s infinite;
}

@keyframes blink {
    50% { opacity: 0.5; }
}

/* ==========================================
   CHROMATIC BELL GRID (PIANO STYLE)
   ========================================== */

.chromatic-card {
    background: linear-gradient(to bottom right, #f8f9fa, #e9ecef);
}

.piano-keyboard {
    display: flex;
    justify-content: center;
    position: relative;
    padding: 20px 0;
    overflow-x: auto;
    margin-bottom: 20px;
    min-height: 220px;
}

.key {
    position: relative;
    float: left;
    margin: 0 2px;
    border-radius: 0 0 5px 5px;
    cursor: pointer;
    box-shadow: 0 4px 5px rgba(0,0,0,0.2);
    transition: all 0.1s;
    user-select: none;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 10px;
    font-weight: bold;
    font-size: 0.9rem;
}

.key:active, .key.active {
    transform: translateY(2px);
    box-shadow: 0 2px 3px rgba(0,0,0,0.2);
}

.key-white {
    width: 45px;
    height: 180px;
    background: white;
    z-index: 1;
    border: 1px solid #ccc;
    color: #333;
}

.key-black {
    width: 30px;
    height: 110px;
    background: #333;
    z-index: 2;
    margin: 0 -17px; /* Overlap */
    color: white;
    border: 1px solid #000;
}

/* Colored tops for keys */
.key::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 15px;
    border-radius: 2px 2px 0 0;
    opacity: 0.8;
}

/* Specific Key Colors */
.key[data-note="C2"]::before, .key[data-note="C2"] { border-top-color: var(--c2-red); border-top-width: 5px; }
.key[data-note="C#2"]::before, .key[data-note="C#2"] { background: var(--cs2-red-orange); }
.key[data-note="D2"]::before, .key[data-note="D2"] { border-top-color: var(--d2-orange); border-top-width: 5px; }
.key[data-note="D#2"]::before, .key[data-note="D#2"] { background: var(--ds2-orange-yellow); }
.key[data-note="E2"]::before, .key[data-note="E2"] { border-top-color: var(--e2-yellow); border-top-width: 5px; }
.key[data-note="F2"]::before, .key[data-note="F2"] { border-top-color: var(--f2-yellow-green); border-top-width: 5px; }
.key[data-note="F#2"]::before, .key[data-note="F#2"] { background: var(--fs2-green); }
.key[data-note="G2"]::before, .key[data-note="G2"] { border-top-color: var(--g2-green-cyan); border-top-width: 5px; }
.key[data-note="G#2"]::before, .key[data-note="G#2"] { background: var(--gs2-cyan); }
.key[data-note="A2"]::before, .key[data-note="A2"] { border-top-color: var(--a2-cyan-blue); border-top-width: 5px; }
.key[data-note="A#2"]::before, .key[data-note="A#2"] { background: var(--as2-blue); }
.key[data-note="B2"]::before, .key[data-note="B2"] { border-top-color: var(--b2-blue-purple); border-top-width: 5px; }

.key[data-note="C3"]::before, .key[data-note="C3"] { border-top-color: var(--c3-purple); border-top-width: 5px; }
.key[data-note="C#3"]::before, .key[data-note="C#3"] { background: var(--cs3-purple-pink); }
.key[data-note="D3"]::before, .key[data-note="D3"] { border-top-color: var(--d3-pink); border-top-width: 5px; }
.key[data-note="D#3"]::before, .key[data-note="D#3"] { background: var(--ds3-pink-rose); }
.key[data-note="E3"]::before, .key[data-note="E3"] { border-top-color: var(--e3-rose); border-top-width: 5px; }
.key[data-note="F3"]::before, .key[data-note="F3"] { border-top-color: var(--f3-hot-pink); border-top-width: 5px; }
.key[data-note="F#3"]::before, .key[data-note="F#3"] { background: var(--fs3-tomato); }
.key[data-note="G3"]::before, .key[data-note="G3"] { border-top-color: var(--g3-orange-red); border-top-width: 5px; }

/* Active State Colors */
.key.active[data-note="C2"] { background: var(--c2-red); color: white; }
.key.active[data-note="D2"] { background: var(--d2-orange); color: white; }
.key.active[data-note="E2"] { background: var(--e2-yellow); color: #333; }
.key.active[data-note="F2"] { background: var(--f2-yellow-green); color: white; }
.key.active[data-note="G2"] { background: var(--g2-green-cyan); color: white; }
.key.active[data-note="A2"] { background: var(--a2-cyan-blue); color: white; }
.key.active[data-note="B2"] { background: var(--b2-blue-purple); color: white; }
.key.active[data-note="C3"] { background: var(--c3-purple); color: white; }
.key.active[data-note="D3"] { background: var(--d3-pink); color: white; }
.key.active[data-note="E3"] { background: var(--e3-rose); color: white; }
.key.active[data-note="F3"] { background: var(--f3-hot-pink); color: white; }
.key.active[data-note="G3"] { background: var(--g3-orange-red); color: white; }

/* Black Keys Active */
.key-black.active { transform: scale(0.95); box-shadow: 0 0 10px currentColor; }

.octave-info {
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    font-size: 0.9rem;
    color: #888;
    margin-top: -10px;
}

/* ==========================================
   COMPOSER CONTROLS
   ========================================== */

.composer-controls {
    margin-bottom: 20px;
}

.color-picker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.composer-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    color: transparent;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: bold;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(0,0,0,0.5);
}

.composer-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    color: rgba(255,255,255,0.9);
}

.composer-btn.sharp {
    border-radius: 8px; /* Square for sharps */
}

/* Song Timeline */
.song-timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 100px;
    background: #fafafa;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 15px;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 1rem;
}

.song-note {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.8);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.2s;
}

.song-note.sharp {
    border-radius: 6px; /* Square for sharps */
}

.song-note:hover {
    transform: scale(1.2);
    z-index: 10;
}

.song-note.playing {
    border: 3px solid #333;
    transform: scale(1.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 20;
}

@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.empty-message {
    color: #aaa;
    width: 100%;
    text-align: center;
    font-style: italic;
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.tempo-control {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

/* ==========================================
   BUTTONS
   ========================================== */

button {
    font-family: inherit;
    transition: all 0.2s;
}

button.primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

button.primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

button.primary:active {
    transform: translateY(1px);
}

button.secondary {
    background-color: #e0e0e0;
    color: #333;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

button.secondary:hover {
    background-color: #d0d0d0;
}

button.danger {
    background: linear-gradient(135deg, #ff3b30, #ff2d55);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================
   SHEET MUSIC
   ========================================== */

#sheet-music-container {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    margin-top: 1.5rem;
    overflow-x: auto;
    min-height: 200px;
    animation: fadeIn 0.3s ease-out;
}

#sheet-music-output {
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

.sheet-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ==========================================
   PRESET SONGS
   ========================================== */

.preset-categories {
    display: grid;
    gap: 20px;
}

.preset-category h3 {
    margin-bottom: 10px;
    color: #555;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.preset-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.preset-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 6px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.preset-btn:before {
    content: '🎵';
    margin-right: 8px;
}

.preset-btn:hover {
    background: #f0f8ff;
    border-color: var(--a2-cyan-blue);
    transform: translateX(3px);
}

/* ==========================================
   GAME MODE
   ========================================== */

.game-card {
    background: linear-gradient(135deg, #2c3e50 0%, #4ca1af 100%);
    color: white;
}

.game-card h2, .game-card h3, .game-card p {
    color: white;
}

.game-section {
    background: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.game-select {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.difficulty-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid transparent;
    color: white;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.difficulty-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.difficulty-btn.active {
    background: rgba(255, 255, 255, 0.4);
    border-color: white;
}

.game-display {
    background: rgba(0, 0, 0, 0.3);
    padding: 2rem;
    border-radius: 12px;
    margin: 1.5rem 0;
    text-align: center;
}

.game-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 2rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
}

.stat-value.combo {
    color: #ffd700;
}

.game-note-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: white;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    margin: 0 auto 1rem auto;
    box-shadow: 0 0 20px rgba(255,255,255,0.5);
    transition: all 0.2s;
}

.game-note-circle.pulse {
    animation: notePulse 0.3s ease-in-out;
}

@keyframes notePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.game-feedback {
    min-height: 40px;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 1rem 0;
}

.progress-bar-container {
    background: rgba(255,255,255,0.2);
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar {
    background: #4cd964;
    height: 100%;
    width: 0%;
    transition: width 0.3s;
}

/* ==========================================
   PRACTICE & LEARNING MODE
   ========================================== */

.learning-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.learning-card h2, .learning-card p {
    color: white;
}

.learning-tabs, .practice-tabs, .tools-tabs, .stats-tabs {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    padding-bottom: 10px;
}

.learning-tab, .practice-tab, .tools-tab, .stats-tab {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    padding: 8px 15px;
    cursor: pointer;
    font-size: 1rem;
    border-radius: 5px;
    transition: all 0.2s;
}

.stats-tab { color: #666; }
.stats-tab.active { background: #eee; color: #333; }

.learning-tab:hover, .practice-tab:hover, .tools-tab:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.learning-tab.active, .practice-tab.active, .tools-tab.active {
    background: white;
    color: #333;
    font-weight: bold;
}

.learning-content, #practice-content, #tools-content, #stats-content {
    background: rgba(0, 0, 0, 0.2); /* Dunklerer Hintergrund für besseren Kontrast */
    padding: 20px;
    border-radius: 10px;
    min-height: 200px;
    color: white; /* Sicherstellen, dass Text weiß ist */
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

/* Spezifisch für Tools-Card, falls sie hell ist */
.tools-card {
    background: linear-gradient(135deg, #4b6cb7 0%, #182848 100%); /* Dunkelblaues Theme */
    color: white;
}

.tools-card h2, .tools-card h3, .tools-card p, .tools-card label {
    color: white;
}

/* Inputs in dunklen Cards */
.tool-control input, .tool-control select {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 8px;
    border-radius: 4px;
    color: #333;
}

.tool-control {
    margin-bottom: 15px;
    background: rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 6px;
}

/* Metronom Styles */
.metronome-display {
    font-size: 3rem;
    font-weight: bold;
    text-align: center;
    margin: 20px 0;
    font-family: monospace;
}

.metronome-dot {
    width: 20px;
    height: 20px;
    background: #555;
    border-radius: 50%;
    margin: 0 auto;
    transition: background 0.1s;
}

.metronome-dot.active {
    background: #ff3b30;
    box-shadow: 0 0 10px #ff3b30;
}

/* ==========================================
   PROGRESS TRACKER
   ========================================== */

.progress-card {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.progress-card h2, .progress-card h3, .progress-card p {
    color: white;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-box {
    background: rgba(255,255,255,0.2);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.skill-bars {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.skill-item {
    background: rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 10px;
}

.skill-bar {
    background: rgba(255,255,255,0.2);
    height: 10px;
    border-radius: 5px;
    margin-top: 5px;
    overflow: hidden;
}

.skill-fill {
    height: 100%;
    background: white;
    width: 0%;
    transition: width 1s ease-out;
}

/* ==========================================
   PRODUCT INFO & FOOTER
   ========================================== */

.product-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.product-description {
    flex: 1;
    min-width: 300px;
}

.specs {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    list-style: none;
    border-left: 4px solid var(--a2-cyan-blue);
}

.specs li {
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

.product-link {
    display: inline-block;
    background: linear-gradient(90deg, var(--c2-red), var(--d2-orange));
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    margin-top: 15px;
    transition: transform 0.2s;
}

.product-link:hover {
    transform: scale(1.05);
}

.color-legend-chromatic {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 15px;
}

.legend-item {
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 4px;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 2rem;
}

.small-text {
    font-size: 0.8rem;
    color: #999;
}

/* ==========================================
   ANIMATIONS
   ========================================== */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.5s ease-out;
}
