/* Banjo Tablature Editor Styles */

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

body {
    font-family: 'Monaco', 'Courier New', monospace;
    background: #f5f5f5;
    padding: 20px;
    color: #333;
}

/* Header & Controls */
header {
    background: white;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

h1 {
    margin-bottom: 20px;
    font-size: 28px;
}

.controls {
    display: grid;
    grid-template-columns: auto auto auto;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    gap: 15px;
    align-items: center;
}

.control-group label {
    font-weight: bold;
    font-size: 14px;
}

.control-group select,
button {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.control-group select:hover,
button:hover {
    border-color: #999;
    background: #fafafa;
}

button {
    background: #4CAF50;
    color: white;
    border: none;
    font-weight: bold;
}

button:hover {
    background: #45a049;
}

#duration-display {
    padding: 8px 12px;
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 4px;
    min-width: 200px;
    text-align: center;
    font-size: 14px;
}

.help-text {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    grid-column: 1 / -1;
}

/* Main Container */
main {
    background: white;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
}

/* Tab Row Layout */
.tab-row {
    display: flex;
    margin-bottom: 50px;
    gap: 0;
    align-items: flex-start;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: fit-content;
}

/* Tuning Column */
.tuning-column {
    display: flex;
    flex-direction: column;
    width: 50px;
    min-width: 50px;
    /* Align with strings: bar padding(15px) + bar-label(~19px+8mb) + note-names(18px+8mb) + ruler(24px+1border) */
    padding-top: 93px;
}

.tuning-selector {
    padding: 0 4px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    background: white;
    cursor: pointer;
    width: 44px;
    height: 24px;
    line-height: 22px;
    margin: 0;
    flex-shrink: 0;
}

.tuning-selector:hover {
    border-color: #999;
    background: #f9f9f9;
}

/* Bar */
.bar {
    position: relative;
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    background: white;
    border-left: 2px solid #333;
    border-right: 3px solid #333;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
}

/* First bar in row - either after tuning column or as first child */
.tuning-column + .bar,
.tab-row > .bar:first-child {
    border-left: 3px solid #333;
}

.bar-label {
    text-align: center;
    font-size: 11px;
    color: #999;
    margin-bottom: 8px;
    font-weight: bold;
}

/* Note Names (above staff) */
.note-names {
    height: 18px;
    font-size: 11px;
    position: relative;
    margin-bottom: 8px;
    min-height: 18px;
}

.note-name {
    position: absolute;
    font-weight: bold;
    color: #c2185b;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
}

/* Ruler */
.ruler {
    height: 24px;
    background: #fafafa;
    border-bottom: 1px solid #ddd;
    position: relative;
    display: flex;
    align-items: flex-end;
}

.ruler-tick {
    position: absolute;
    border-left: 1px solid #ccc;
    height: 8px;
    font-size: 9px;
    color: #999;
    padding-left: 2px;
}

.ruler-beat {
    position: absolute;
    border-left: 2px solid #333;
    height: 12px;
}

/* Strings */
.strings-container {
    position: relative;
    display: flex;
    flex-direction: column;
}

.string-line {
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
}

.string-line::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #333;
}

/* Fret number on staff - clean tablature style */
.note {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 0 3px;
    font-size: 14px;
    font-weight: bold;
    color: #000;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
}

.note:hover {
    color: #2196F3;
}

/* Stem area below the staff */
.stem-area {
    position: relative;
    height: 24px;
    margin-bottom: 15px;
}

/* Individual stem from note down to beam */
.note-stem {
    position: absolute;
    width: 1.5px;
    background: #000;
    pointer-events: none;
}

/* Horizontal beam connecting stems */
.note-beam {
    position: absolute;
    background: #000;
    height: 4px;
    pointer-events: none;
    bottom: 0;
}

/* Second beam for sixteenth notes */
.note-beam.second {
    bottom: 7px;
}

/* Click targets for note entry */
.click-target {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 22px;
    cursor: pointer;
    z-index: 5;
    border-radius: 2px;
}

.click-target:hover {
    background: rgba(33, 150, 243, 0.2);
}

.click-target.focused {
    background: rgba(33, 150, 243, 0.35);
    outline: 2px solid #2196F3;
}

/* Beat grid lines for visual positioning */
.beat-grid {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

.beat-grid.downbeat {
    background: rgba(0, 0, 0, 0.25);
    width: 1px;
}

/* Hide grid when toggle is off */
.hide-grid .beat-grid {
    display: none;
}

.hide-grid .beat-grid.downbeat {
    display: block;
    background: rgba(0, 0, 0, 0.15);
}

.bar-number {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: #999;
    font-weight: bold;
}

/* Bar controls (+/-) */
.bar-controls {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    z-index: 100;
}

.bar-controls button {
    width: 22px;
    height: 22px;
    padding: 0;
    font-size: 14px;
    font-weight: bold;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #f5f5f5;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.bar-controls button:hover {
    background: #e0e0e0;
    border-color: #999;
    color: #333;
}

.bar-controls button.delete:hover {
    background: #ffebee;
    border-color: #f44336;
    color: #f44336;
}

/* Input hint tooltip */
.input-hint {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 15px 20px;
    border-radius: 4px;
    font-size: 12px;
    max-width: 250px;
    line-height: 1.5;
    display: none;
    z-index: 1000;
}

.input-hint.active {
    display: block;
}

.input-hint strong {
    display: block;
    margin-bottom: 5px;
    color: #4CAF50;
}
