/* Audio to MIDI Tool Styles */

/* Waveform Styles */
#waveform {
    background: var(--bs-light-border-subtle);
    border-radius: 4px;
    overflow: hidden;
}

[data-bs-theme="dark"] #waveform {
    background: rgba(30, 34, 42, 0.6);
}

/* Waveform Controls */
.waveform-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
}

.waveform-play-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #495057;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.waveform-play-btn:hover {
    background: #495057;
    transform: scale(1.05);
}

.waveform-play-btn:active {
    transform: scale(0.95);
}

.waveform-play-btn .play-icon,
.waveform-play-btn .pause-icon {
    width: 20px;
    height: 20px;
    filter: invert(30%) sepia(5%) saturate(500%) hue-rotate(180deg) brightness(95%) contrast(90%);
    transition: filter 0.2s ease;
}

.waveform-play-btn:hover .play-icon,
.waveform-play-btn:hover .pause-icon {
    filter: brightness(0) invert(1);
}

[data-bs-theme="dark"] .waveform-play-btn {
    border-color: #6c757d;
}

[data-bs-theme="dark"] .waveform-play-btn:hover {
    background: #6c757d;
}

[data-bs-theme="dark"] .waveform-play-btn .play-icon,
[data-bs-theme="dark"] .waveform-play-btn .pause-icon {
    filter: invert(50%) sepia(5%) saturate(300%) hue-rotate(180deg) brightness(110%) contrast(90%);
}

[data-bs-theme="dark"] .waveform-play-btn:hover .play-icon,
[data-bs-theme="dark"] .waveform-play-btn:hover .pause-icon {
    filter: brightness(0) invert(1);
}

/* Time Display */
.waveform-time {
    font-family: 'Courier New', Consolas, monospace;
    font-size: 15px;
    font-weight: 500;
    color: var(--bs-body-color);
}

.waveform-time .current-time {
    color: #212529;
    font-weight: 600;
}

.waveform-time .time-separator {
    margin: 0 4px;
    opacity: 0.5;
}

.waveform-time .total-time {
    opacity: 0.6;
}

[data-bs-theme="dark"] .waveform-time .current-time {
    color: #f8f9fa;
}

/* Statistics Cards */
.stat-card {
    background: var(--bs-light-border-subtle);
    border-radius: 8px;
    border: 1px solid var(--bs-border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--bs-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--bs-secondary);
    margin-top: 4px;
}

[data-bs-theme="dark"] .stat-card {
    background: rgba(30, 34, 42, 0.6);
    border-color: rgba(168, 85, 247, 0.3);
}

[data-bs-theme="dark"] .stat-value {
    color: #6ea8fe;
}

/* ============================================
   PROFESSIONAL PIANO ROLL - DAW Style
   ============================================ */

.piano-roll-card {
    overflow: hidden;
}

.piano-roll-card .card-body {
    background: #0a0a12;
}

/* Time Ruler */
.piano-roll-time-ruler-wrapper {
    display: flex;
    height: 24px;
    background: #0f0f1a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.piano-roll-corner {
    width: 70px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1a 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.piano-roll-time-ruler {
    flex: 1;
    overflow-x: hidden;
    overflow-y: hidden;
}

#timeRulerCanvas {
    display: block;
}

/* Piano Roll Main Area - Fixed height, horizontal scroll only */
.piano-roll-wrapper {
    display: flex;
    height: 400px; /* Fixed height to fit piano keys */
    overflow: hidden;
}

/* Fullscreen mode */
.piano-roll-card.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

.piano-roll-card.fullscreen .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.piano-roll-card.fullscreen .piano-roll-wrapper {
    flex: 1;
    height: auto !important;
}

/* Piano Keys Sidebar - FL Studio style */
.piano-keys-sidebar {
    width: 70px;
    flex-shrink: 0;
    background: linear-gradient(90deg, #2a2a3e 0%, #1a1a2e 100%);
    border-right: 2px solid #00d4ff;
    overflow: hidden; /* No scroll - fixed keys */
}

.piano-key {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 9px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.1s ease;
    box-sizing: border-box;
}

.piano-key.white {
    background: linear-gradient(90deg, #e8e8e8 0%, #f5f5f5 50%, #ffffff 100%);
    color: #333;
    border-bottom: 1px solid #ccc;
}

.piano-key.black {
    background: linear-gradient(90deg, #1a1a1a 0%, #2d2d2d 50%, #1a1a1a 100%);
    color: #888;
    border-bottom: 1px solid #111;
}

.piano-key:hover {
    filter: brightness(1.1);
}

.piano-key.white:hover {
    background: linear-gradient(90deg, #d0e8ff 0%, #e0f0ff 50%, #ffffff 100%);
}

.piano-key.black:hover {
    background: linear-gradient(90deg, #2a3a4a 0%, #3a4a5a 50%, #2a3a4a 100%);
}

.piano-key .key-label {
    font-weight: 700;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.piano-key.white .key-label {
    color: #052c65;
}

.piano-key.black .key-label {
    color: #00d4ff;
}

/* Piano Roll Container - Horizontal scroll only */
.piano-roll-container {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    background: #1a1a2e;
    position: relative;
}

#pianoRollCanvas {
    display: block;
    cursor: crosshair;
}

/* Playhead */
.piano-roll-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #00d4ff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.8),
                0 0 20px rgba(0, 212, 255, 0.4);
    z-index: 10;
    pointer-events: none;
    transition: left 0.05s linear;
}

.piano-roll-playhead::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -4px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 8px solid #00d4ff;
}

/* Info Bar */
.piano-roll-info-bar {
    display: flex;
    gap: 20px;
    padding: 8px 12px;
    background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #888;
}

.piano-roll-info-bar .info-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.piano-roll-info-bar strong {
    color: #00d4ff;
    font-weight: 600;
}

.piano-roll-info-bar span {
    color: #ccc;
}

/* Velocity Bar in Table */
.velocity-bar {
    position: relative;
    width: 80px;
    height: 18px;
    background: linear-gradient(90deg, #1a1a2e 0%, #2a2a3e 100%);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.velocity-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #00cc55 0%, #00ff66 100%);
    border-radius: 2px;
    transition: width 0.2s ease;
}

.velocity-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

/* Card Styles */
.card {
    border-radius: 8px;
    border: 1px dotted var(--bs-dark-bg-subtle);
    background: var(--bs-light-border-subtle);
}

.card-header {
    background: var(--bs-secondary-bg-subtle);
    border-bottom: 1px dotted var(--bs-dark-bg-subtle);
}

[data-bs-theme="dark"] .card {
    background-color: rgba(30, 34, 42, 0.6);
    border-color: rgba(168, 85, 247, 0.3);
}

[data-bs-theme="dark"] .card-header {
    background: rgba(30, 34, 42, 0.8);
    border-bottom-color: rgba(168, 85, 247, 0.3);
}

/* Filter SVG for icons */
.filter-svg {
    filter: none;
}

[data-bs-theme="dark"] .filter-svg {
    filter: invert(1) brightness(0.8);
}

/* Alert Info Dark Mode */
[data-bs-theme="dark"] .alert-info {
    background-color: #132a4a;
    border-color: #0d6efd;
    color: #9db5d0;
}

/* Form Controls */
.form-label {
    cursor: default;
    user-select: none;
}

.form-control[readonly] {
    cursor: default;
}

/* ============================================
   FORM RANGE SLIDER (striped pattern style)
   ============================================ */

.form-range {
    height: 8px;
    background: repeating-linear-gradient(
        45deg,
        #e9ecef,
        #e9ecef 5px,
        #d3d6d9 5px,
        #d3d6d9 10px
    );
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #052c65;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.form-range::-webkit-slider-thumb:hover {
    background: #041f4a;
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.form-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #052c65;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.form-range::-moz-range-thumb:hover {
    background: #041f4a;
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.form-range::-webkit-slider-runnable-track {
    height: 8px;
    background: repeating-linear-gradient(
        45deg,
        #e9ecef,
        #e9ecef 5px,
        #d3d6d9 5px,
        #d3d6d9 10px
    );
    border-radius: 4px;
}

.form-range::-moz-range-track {
    height: 8px;
    background: repeating-linear-gradient(
        45deg,
        #e9ecef,
        #e9ecef 5px,
        #d3d6d9 5px,
        #d3d6d9 10px
    );
    border-radius: 4px;
}

.form-range::-moz-range-progress {
    height: 8px;
    background: #052c65;
    border-radius: 4px;
}

/* Dark mode slider */
[data-bs-theme="dark"] .form-range {
    background: repeating-linear-gradient(
        45deg,
        #343a40,
        #343a40 5px,
        #495057 5px,
        #495057 10px
    );
}

[data-bs-theme="dark"] .form-range::-webkit-slider-thumb {
    background: #6ea8fe;
}

[data-bs-theme="dark"] .form-range::-webkit-slider-thumb:hover {
    background: #9ec5fe;
}

[data-bs-theme="dark"] .form-range::-moz-range-thumb {
    background: #6ea8fe;
}

[data-bs-theme="dark"] .form-range::-moz-range-thumb:hover {
    background: #9ec5fe;
}

[data-bs-theme="dark"] .form-range::-webkit-slider-runnable-track {
    background: repeating-linear-gradient(
        45deg,
        #343a40,
        #343a40 5px,
        #495057 5px,
        #495057 10px
    );
}

[data-bs-theme="dark"] .form-range::-moz-range-track {
    background: repeating-linear-gradient(
        45deg,
        #343a40,
        #343a40 5px,
        #495057 5px,
        #495057 10px
    );
}

[data-bs-theme="dark"] .form-range::-moz-range-progress {
    background: #6ea8fe;
}

/* Table Styles */
.table-responsive {
    border-radius: 4px;
}

.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Progress in table */
.table .progress {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.table .progress-bar {
    font-size: 10px;
    line-height: 15px;
}

/* Button Styles */
.btn img {
    display: inline-block;
    vertical-align: middle;
}

/* Badge in Note Column */
.badge {
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .piano-roll-wrapper {
        height: 300px;
    }

    .piano-keys-sidebar {
        width: 50px;
    }

    .piano-key {
        font-size: 7px;
    }

    .piano-key .key-label {
        font-size: 7px;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .waveform-play-btn {
        width: 42px;
        height: 42px;
    }

    .waveform-play-btn .play-icon,
    .waveform-play-btn .pause-icon {
        width: 18px;
        height: 18px;
    }

    .waveform-time {
        font-size: 14px;
    }

    .piano-roll-info-bar {
        font-size: 10px;
        gap: 10px;
        padding: 6px 8px;
    }
}

/* Scrollbar Styles - More visible */
.piano-roll-container::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.piano-roll-container::-webkit-scrollbar-track {
    background: #1a1a2e;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.piano-roll-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #4a4a6a 0%, #3a3a5a 100%);
    border-radius: 6px;
    border: 2px solid #1a1a2e;
}

.piano-roll-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #5a5a7a 0%, #4a4a6a 100%);
}

.piano-roll-container::-webkit-scrollbar-corner {
    background: #1a1a2e;
}

[data-bs-theme="dark"] .piano-roll-container::-webkit-scrollbar-track {
    background: #0a0a12;
    border-color: rgba(255, 255, 255, 0.15);
}

[data-bs-theme="dark"] .piano-roll-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #3a5a8a 0%, #2a4a7a 100%);
    border-color: #0a0a12;
}

[data-bs-theme="dark"] .piano-roll-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #4a6a9a 0%, #3a5a8a 100%);
}

/* Table Responsive Scrollbar */
.table-responsive::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Sticky Table Header */
.sticky-top {
    position: sticky;
    top: 0;
    z-index: 1;
}

.table thead.sticky-top th {
    background: var(--bs-body-bg);
    border-bottom: 2px solid var(--bs-border-color);
}

[data-bs-theme="dark"] .table thead.sticky-top th {
    background: rgba(30, 34, 42, 0.95);
}
