/* Main styles for C64 SID Player */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 240px;
    height: 282px;
    background: #1a1a1a;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#app {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    border: 5px solid #ff6600;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0a0a0a;
    padding: 4px 8px;
    border-bottom: 2px solid #444;
    flex-shrink: 0;
}

header h1 {
    font-size: 14px;
    font-weight: bold;
    color: #ffcc00;
    text-transform: uppercase;
}

.menu-button {
    background: none;
    border: none;
    color: #ffcc00;
    font-size: 16px;
    cursor: pointer;
    padding: 2px;
}

/* Navigation Menu */
.menu-nav {
    position: fixed;
    right: -200px;
    top: 0;
    width: 160px;
    height: 282px;
    background: #1a1a1a;
    border-left: 2px solid #444;
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding-top: 8px;
}

.menu-nav.open {
    right: 0;
}

.close-menu {
    align-self: flex-end;
    background: none;
    border: none;
    color: #ffcc00;
    font-size: 16px;
    cursor: pointer;
    margin-right: 8px;
    margin-bottom: 8px;
}

.menu-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-nav a {
    display: block;
    padding: 8px 12px;
    color: #e0e0e0;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.menu-nav a:hover,
.menu-nav a.active {
    background: #333;
    border-left-color: #ffcc00;
    color: #ffcc00;
}

/* Main Content */
main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    display: flex;
    flex-direction: column;
}

main::-webkit-scrollbar {
    width: 6px;
}

main::-webkit-scrollbar-track {
    background: #0a0a0a;
}

main::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

/* Welcome Screen */
.welcome {
    text-align: center;
    padding: 20px 8px;
}

.welcome h2 {
    color: #ffcc00;
    font-size: 14px;
    margin-bottom: 12px;
}

.welcome p {
    font-size: 10px;
    color: #999;
    line-height: 1.4;
}

/* Player Page */
.player-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
}

.now-playing {
    background: #2a2a2a;
    border: 1px solid #444;
    padding: 8px;
    border-radius: 3px;
}

.now-playing h3 {
    color: #ffcc00;
    font-size: 11px;
    margin-bottom: 4px;
}

.track-title {
    color: #e0e0e0;
    font-size: 10px;
    word-break: break-word;
    line-height: 1.3;
}

.track-info {
    font-size: 9px;
    color: #999;
    margin-top: 4px;
}

.progress-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.progress-bar {
    height: 6px;
    background: #0a0a0a;
    border: 1px solid #444;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffcc00, #ff6600);
    width: 0%;
    transition: width 0.1s linear;
    box-shadow: 0 0 4px rgba(255, 204, 0, 0.5);
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: #999;
}

.player-controls {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px;
}

.control-btn {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #ffcc00;
    padding: 6px;
    font-size: 10px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s ease;
    font-weight: bold;
}

.control-btn:hover {
    background: #3a3a3a;
    border-color: #ffcc00;
    box-shadow: 0 0 4px rgba(255, 204, 0, 0.3);
}

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

.control-btn.playing {
    background: #ffcc00;
    color: #1a1a1a;
}

.player-info {
    background: #2a2a2a;
    border: 1px solid #444;
    padding: 6px;
    border-radius: 3px;
    font-size: 9px;
    color: #999;
    line-height: 1.4;
}

/* Browse Page */
.browse-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-box {
    display: flex;
    gap: 4px;
}

.search-input {
    flex: 1;
    background: #2a2a2a;
    border: 1px solid #444;
    color: #e0e0e0;
    padding: 4px;
    font-size: 10px;
    border-radius: 2px;
}

.search-btn {
    background: #ffcc00;
    border: 1px solid #ffcc00;
    color: #1a1a1a;
    padding: 4px 8px;
    font-size: 10px;
    cursor: pointer;
    border-radius: 2px;
    font-weight: bold;
}

.search-btn:hover {
    background: #ffee00;
}

.source-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-bottom: 4px;
}

.source-tab {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #999;
    padding: 6px;
    font-size: 10px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s ease;
    text-align: center;
}

.source-tab.active {
    background: #ffcc00;
    color: #1a1a1a;
    border-color: #ffcc00;
    font-weight: bold;
}

.browse-results {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.browse-item {
    background: #2a2a2a;
    border: 1px solid #444;
    padding: 6px;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.browse-item:hover {
    background: #3a3a3a;
    border-color: #ffcc00;
}

.browse-item-title {
    color: #ffcc00;
    font-size: 10px;
    font-weight: bold;
    word-break: break-word;
}

.browse-item-info {
    font-size: 8px;
    color: #999;
}

.browse-item-action {
    background: #1a5a1a;
    border: 1px solid #2a8a2a;
    color: #00ff00;
    padding: 4px;
    font-size: 9px;
    cursor: pointer;
    border-radius: 2px;
    text-align: center;
    transition: all 0.2s ease;
    margin-top: 2px;
}

.browse-item-action:hover {
    background: #2a8a2a;
    box-shadow: 0 0 4px rgba(0, 255, 0, 0.3);
}

/* Library Page */
.library-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.library-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.library-empty {
    text-align: center;
    padding: 20px 8px;
    color: #666;
    font-size: 10px;
}

.library-item {
    background: #2a2a2a;
    border: 1px solid #444;
    padding: 6px;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.library-item:hover {
    background: #3a3a3a;
    border-color: #ffcc00;
}

.library-item-title {
    color: #ffcc00;
    font-size: 10px;
    font-weight: bold;
    word-break: break-word;
}

.library-item-subtitle {
    font-size: 8px;
    color: #999;
}

.library-item-actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.lib-action-btn {
    flex: 1;
    background: #1a3a5a;
    border: 1px solid #2a5a8a;
    color: #00ccff;
    padding: 3px;
    font-size: 8px;
    cursor: pointer;
    border-radius: 2px;
    text-align: center;
    transition: all 0.2s ease;
}

.lib-action-btn:hover {
    background: #2a5a8a;
    box-shadow: 0 0 4px rgba(0, 204, 255, 0.3);
}

.lib-action-btn.delete {
    background: #5a1a1a;
    border-color: #8a2a2a;
    color: #ff6666;
}

.lib-action-btn.delete:hover {
    background: #8a2a2a;
    box-shadow: 0 0 4px rgba(255, 102, 102, 0.3);
}

/* Settings Page */
.settings-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-group {
    background: #2a2a2a;
    border: 1px solid #444;
    padding: 8px;
    border-radius: 3px;
}

.settings-group h3 {
    color: #ffcc00;
    font-size: 11px;
    margin-bottom: 6px;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 10px;
}

.settings-item:last-child {
    margin-bottom: 0;
}

.settings-label {
    color: #e0e0e0;
}

.settings-control {
    background: #1a1a1a;
    border: 1px solid #444;
    color: #ffcc00;
    padding: 2px 6px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 9px;
}

.toggle {
    width: 32px;
    height: 18px;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 9px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle.on {
    background: #1a5a1a;
    border-color: #2a8a2a;
}

.toggle-knob {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #666;
    border-radius: 50%;
    top: 1px;
    left: 1px;
    transition: all 0.3s ease;
}

.toggle.on .toggle-knob {
    left: 17px;
    background: #00ff00;
}

.storage-info {
    font-size: 9px;
    color: #999;
    padding: 4px;
    background: #1a1a1a;
    border-radius: 2px;
    margin-top: 4px;
}

/* Status Bar / Footer */
.status-bar {
    background: #0a0a0a;
    border-top: 2px solid #444;
    padding: 4px 8px;
    font-size: 9px;
    color: #999;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 282px;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    background: #1a1a1a;
    border: 2px solid #ffcc00;
    border-radius: 3px;
    width: 90%;
    max-height: 85%;
    overflow-y: auto;
    position: relative;
    padding: 8px;
}

.modal-close {
    position: absolute;
    top: 4px;
    right: 4px;
    background: none;
    border: none;
    color: #ffcc00;
    font-size: 16px;
    cursor: pointer;
}

#modalBody {
    color: #e0e0e0;
    font-size: 10px;
    line-height: 1.4;
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 8px;
    height: 8px;
    border: 1px solid #ffcc00;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Retro C64 styling */
@media (prefers-color-scheme: dark) {
    /* Already dark by default */
}

/* Text selection */
::selection {
    background: #ffcc00;
    color: #1a1a1a;
}

::-moz-selection {
    background: #ffcc00;
    color: #1a1a1a;
}

/* Focus styles for accessibility */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #ffcc00;
    outline-offset: 1px;
}
