:root {
    --bg-dark: #0f1115;
    --bg-card: #161b22;
    --bg-hover: #1f2633;
    --accent: #3b82f6;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --border: #2d3748;
    --danger: #ef4444;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh; /* Fallback */
    height: 100dvh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.logo span {
    color: var(--accent);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 20px;
}

.song-list-container {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.song-list-container h2 {
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 500;
}

/* Date Groups */
.date-group {
    margin-bottom: 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    overflow: hidden;
}

.group-header {
    padding: 12px 16px;
    background: var(--bg-hover);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    font-weight: 500;
    user-select: none;
}

.group-title {
    color: var(--text-primary);
}

.group-count {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.group-content {
    display: flex;
    flex-direction: column;
}

.group-content.hidden {
    display: none;
}

/* Clip Row */
.clip-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    transition: background 0.2s;
}

.clip-row:hover {
    background: var(--bg-hover);
}

.clip-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.clip-play-btn {
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8em;
    padding-left: 2px;
    /* Visual center adjustment */
}

.clip-play-btn:hover {
    filter: brightness(1.1);
}

.clip-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.clip-title {
    font-weight: 500;
    cursor: pointer;
}

.clip-title.editable:hover {
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: var(--text-secondary);
}

.clip-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    gap: 10px;
    align-items: center;
}

.clip-meta span {
    display: inline-block;
}

.duration {
    font-family: monospace;
    background: rgba(255, 255, 255, 0.05);
    padding: 1px 4px;
    border-radius: 4px;
}

.timestamp {
    font-family: monospace;
    color: var(--accent);
    padding: 1px 4px;
    font-size: 0.9em;

    font-size: 0.9em;
}

.tempo {
    color: var(--accent);
}

.comment {
    font-style: italic;
    cursor: pointer;
    color: #64748b;
}

.comment:hover {
    color: var(--text-primary);
}

.edit-input {
    background: #0f1115;
    border: 1px solid var(--accent);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: inherit;
    font-family: inherit;
    width: 100%;
}

width: 100%;
}

.btn-download {
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    padding: 6px;
    border-radius: 4px;
    font-size: 1.1rem;
    transition: opacity 0.2s;
    margin-right: 5px;
}

.btn-download:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.btn-delete {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    opacity: 0.5;
    padding: 6px;
    border-radius: 4px;
    font-size: 1.1rem;
    transition: opacity 0.2s;
}

.btn-delete:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
}


/* Player */
.player-container {
    height: 100px;
    flex-shrink: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
    border-radius: 12px 12px 0 0;
}

.now-playing-info {
    width: 200px;
}

.now-playing-info h3 {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.now-playing-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

#audio-player {
    flex: 1;
    height: 40px;
}

@media (max-width: 768px) {
    .player-container {
        flex-direction: column;
        height: auto;
        padding: 15px;
        gap: 10px;
    }
    .now-playing-info {
        width: 100%;
        text-align: center;
    }
    #audio-player {
        width: 100%;
        flex: none;
    }
}

/* Batch Actions */
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.batch-actions.hidden {
    display: none;
}

.btn-danger {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-danger:hover {
    background: #c0392b;
}

/* Clip Row Updates */
.clip-checkbox {
    margin-right: 12px;
    transform: scale(1.2);
    cursor: pointer;
}

.clip-id {
    font-family: monospace;
    font-size: 0.85rem;
    color: #ed8936;
    /* Nice orange */
    margin-right: 10px;
    min-width: 30px;
}

/* Nav Styles */
.main-nav {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.btn-nav {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 16px;
    cursor: pointer;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-nav:hover:not(.active) {
    color: var(--text-primary);
}

.btn-nav.active {
    background: var(--bg-hover);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.view.hidden {
    display: none;
}

/* Player Adjustments */
.player-container {
    height: auto;
    flex-direction: column;
    padding: 20px;
    gap: 15px;
}

.now-playing-info {
    width: 100%;
    text-align: center;
}

.tag-list {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 5px;
}

.tag {
    background: var(--bg-hover);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    color: var(--accent);
}

/* Custom Progress */
.player-visual {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.custom-progress {
    width: 100%;
    height: 24px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    width: 0%;
}

.marker-track {
    position: absolute;
    top: -10px;
    left: 0;
    width: 100%;
    height: 26px;
    pointer-events: none;
}

.marker-tick {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: #ed8936;
    z-index: 2;
}

.marker-label-timeline {
    position: absolute;
    top: -8px;
    font-size: 0.65rem;
    color: var(--text-primary);
    white-space: nowrap;
    margin-left: 4px;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9), 0 -1px 3px rgba(0,0,0,0.9);
    z-index: 3;
    font-weight: 500;
}

.time-display {
    text-align: center;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Player Controls */
.player-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
    width: 100%;
}

.player-controls button {
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg-hover);
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 500;
}

.player-controls button:hover {
    background: var(--border);
}

.player-controls .btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.main-controls-row {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.main-controls-row button {
    font-size: 1.2rem;
    padding: 10px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loop-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    border: none;
}

.loop-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding-right: 5px;
    user-select: none;
}

.btn-loop-segment {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px !important;
}

.btn-loop-segment:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-loop-segment.active {
    background: var(--accent);
    color: white;
    font-weight: 600;
    border-color: var(--accent);
}

.marker-btns {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.marker-btns input {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: white;
    padding: 8px;
    border-radius: 4px;
    width: 150px;
}

/* Marker List */
.marker-list-container {
    width: 100%;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.marker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
}

.marker-header h4 {
    font-size: 0.9rem;
    margin-bottom: 0;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px;
    transition: transform 0.2s;
    pointer-events: none;
}

.marker-list-container.collapsed .btn-icon {
    transform: rotate(-90deg);
}

.marker-list-container.collapsed .marker-list {
    display: none;
}

.marker-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.marker-item {
    background: var(--bg-hover);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    display: flex;
    gap: 8px;
    align-items: center;
    cursor: pointer;
}

.marker-item:hover {
    background: var(--border);
}

.marker-item .marker-label {
    font-weight: 600;
}

.marker-item .marker-time {
    color: var(--text-secondary);
    font-family: monospace;
}

.marker-item .marker-delete {
    color: var(--danger);
    font-weight: bold;
    margin-left: 5px;
}