:root {
    --panel-width: 280px;
}
html {
    scroll-behavior: smooth;
}
body {
    font-family: sans-serif;
    margin: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
    background-color: #fff; /* Changed background to white */
}
.main-content {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    transition: margin-right 0.3s ease;
}
.main-content.panel-open {
    margin-right: var(--panel-width);
}
.song-info {
    margin-bottom: 20px;
}
.song-info input {
    width: 100%;
    padding: 4px 8px;
    box-sizing: border-box;
    border: 1px solid transparent;
    background-color: transparent;
    outline: none;
    border-radius: 4px;
    transition: background-color 0.2s, border-color 0.2s;
    margin-bottom: 0;
}
.song-info input:hover {
    background-color: #f0f0f0;
}
.song-info input:focus {
    background-color: #fff;
    border-color: #ccc;
}
#song-title {
    font-size: 2.2em;
    font-weight: bold;
    color: #222;
}
#song-artist {
    font-size: 1.4em;
    font-style: italic;
    color: #555;
    margin-bottom: 15px;
}
#song-copyright {
    font-size: 0.9em;
    color: #777;
    margin-bottom: 2px;
}
.chord-toolbar {
    margin-bottom: 20px;
    padding: 10px;
    background-color: #fff;
}
.chord-placeholder {
    display: inline-block;
    width: 80px;
    height: 90px;
    cursor: grab;
    user-select: none;
    margin-right: 10px;
    vertical-align: top;
}

/* --- Section Styles --- */
#song-container {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Reduced gap for a more continuous look */
}
.song-section {
    /* Borders and background removed for WYSIWYG feel */
    position: relative; 
}
.section-header {
    /* Header is now just bold text */
    padding: 8px 15px;
    font-size: 1.1em;
    font-weight: bold;
    color: #000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.lyrics-editor {
    padding: 15px;
    min-height: 100px;
    white-space: pre-wrap;
    line-height: 2.5;
}
.lyrics-editor:focus {
    outline: 1px solid #007bff;
}
.char, .chord-container {
    display: inline-block;
    vertical-align: bottom;
}
.char:hover { background-color: #e0e0e0; }
.chord-container { position: relative; }
.chord {
    position: absolute;
    bottom: 1.2em;
    left: 0;
    font-weight: bold;
    color: #d00;
    cursor: grab;
    user-select: none;
    transition: color 0.2s;
}
.chord.playing {
    color: #007bff;
}
.chord-container:not(:has(.char)) {
    padding-right: 2px;
    padding-left: 2px;
}

/* --- Comment Styles --- */
.section-header.comment, .section-header.comment-italic {
    font-style: italic;
    color: #555;
}
.section-header.comment-box {
    border: 1px solid #ccc;
    background-color: #f9f9f9;
    padding: 10px;
}

/* --- Page Break Style --- */
.page-break-indicator {
    text-align: center;
    margin: 20px 0;
    padding: 0 15px;
    color: #888;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 15px;
}
.page-break-indicator::before,
.page-break-indicator::after {
    content: '';
    flex-grow: 1;
    height: 1px;
    background-color: #ccc;
}

/* --- In-line Delete Button --- */
.section-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #ccc;
    font-size: 1em;
    padding: 5px;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
}
.song-section:hover .section-delete-btn {
    visibility: visible;
    opacity: 1;
}
.section-delete-btn:hover {
    color: #dc3545; /* Red */
}
/* Special positioning for page break delete button */
.song-section[data-type="Page Break"] .section-delete-btn {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
}

/* --- Side Panel --- */
.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--panel-width);
    height: 100%;
    background-color: #e9ecef;
    border-left: 1px solid #ccc;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}
.side-panel.open {
    transform: translateX(0);
}
.panel-header {
    padding: 10px;
    background-color: #343a40;
    color: white;
    font-size: 1.2em;
}
.panel-controls {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-bottom: 1px solid #ccc;
}
.panel-controls label {
    display: block;
    font-size: 0.8em;
    color: #555;
    margin-bottom: 4px;
}
.control-row {
    display: flex;
    gap: 10px;
    align-items: center;
}
.control-row select, .control-row input {
    flex-grow: 1;
}
.control-row input[type="number"] {
    width: 70px;
    flex-grow: 0;
}
.control-row input[type="checkbox"] {
    flex-grow: 0;
    width: auto;
    margin-left: 5px;
}
.panel-controls select, .panel-controls button, .panel-controls input {
    padding: 8px;
}
.checkbox-row {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-top: 5px;
}
.checkbox-row > div {
    display: flex;
    align-items: center;
    gap: 5px;
}
.checkbox-row label {
    margin: 0;
    font-size: 0.9em;
    user-select: none;
}
#section-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex-grow: 1;
}
.panel-actions {
    padding: 15px 10px;
    border-top: 1px solid #ccc;
    background-color: #e9ecef;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.panel-actions button {
    width: 100%;
    padding: 10px;
}
#section-list li {
    display: flex;
    align-items: center;
    padding: 12px 10px;
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    user-select: none;
}
#section-list li:hover { background-color: #f8f9fa; }
#section-list li.page-break-item {
    color: #888;
    font-style: italic;
}
#section-list li.page-break-item .section-name {
    cursor: default;
}
#section-list li.drag-over {
    border-top: 2px solid orange;
}
.section-name { flex-grow: 1; }
.section-name-input {
    flex-grow: 1;
    padding: 4px;
    font-size: 1em;
    border: 1px solid #007bff;
}
.delete-section-btn-panel {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 1.2em;
    visibility: hidden;
}
#section-list li:hover .delete-section-btn-panel {
    visibility: visible;
}

/* --- Panel Toggle Button --- */
#toggle-panel-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
    width: 45px;
    height: 45px;
    background-color: #343a40;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2em;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: right 0.3s ease;
}

/* --- SVGuitar Styles --- */
.svguitar-chord-column {
    width: 50px;
}
.svguitar {
    width: 100%; /* Make SVG fill its container */
}
.name {
    width: 20em;
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}
.modal-overlay.hidden {
    display: none;
}
.modal-content {
    background: #fff;
    padding: 20px 30px;
    border-radius: 8px;
    width: 80%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.8em;
    cursor: pointer;
    color: #888;
}
.modal-content h2 {
    margin-top: 0;
}
#export-textarea, #import-textarea {
    width: 100%;
    min-height: 300px;
    margin-bottom: 10px;
    box-sizing: border-box;
}
.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.search-form input {
    flex-grow: 1;
    padding: 8px;
}
#chord-search-results {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-height: 40vh;
    overflow-y: auto;
    border-top: 1px solid #eee;
    margin-top: 20px;
    padding: 10px; 
}
.search-result-item {
    text-align: center;
    cursor: pointer;
}
.search-result-item .chord-placeholder:hover {
    border-color: #007bff;
}

.chord-wrapper {
	display: inline-block;
	text-align: center;
    vertical-align: top;
    margin-right: 10px;
}

.chord-wrapper span {
	font-size: 12px;
	display: block;
}
#add-new-chord-btn {
    width: 100%;
    height: 100%;
    font-size: 3em;
    color: #ccc;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    border: 2px dashed #ccc;
    box-sizing: border-box;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.2s, border-color 0.2s;
}
#add-new-chord-btn:hover {
    color: #aaa;
    border-color: #aaa;
}

