/* Reset and base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
    line-height: 1.6;
}

a {
    color: #6c9bff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Navigation */
.navbar {
    background: #16213e;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #2a2a4a;
}

.navbar-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: #6c9bff;
}

.navbar-brand:hover {
    text-decoration: none;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-nav a {
    color: #b0b0b0;
    font-size: 0.9rem;
}

.navbar-nav a:hover {
    color: #e0e0e0;
    text-decoration: none;
}

.navbar-user {
    color: #888;
    font-size: 0.85rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border: 1px solid #4a4a6a;
    border-radius: 6px;
    background: #2a2a4a;
    color: #e0e0e0;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    text-decoration: none;
}

.btn:hover {
    background: #3a3a5a;
    border-color: #6c9bff;
    text-decoration: none;
}

.btn-primary {
    background: #1a5fb4;
    border-color: #1a5fb4;
    color: #fff;
}

.btn-primary:hover {
    background: #2570cc;
    border-color: #2570cc;
}

.btn-small {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

.btn-large {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
}

/* Forms (login/register) */
.auth-container {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    background: #16213e;
    border-radius: 12px;
    border: 1px solid #2a2a4a;
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    color: #b0b0b0;
}

.form-group input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: #1a1a2e;
    border: 1px solid #3a3a5a;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.95rem;
}

.form-group input:focus {
    outline: none;
    border-color: #6c9bff;
}

.form-actions {
    margin-top: 1.25rem;
}

.form-actions .btn {
    width: 100%;
    text-align: center;
}

.form-footer {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #888;
}

.error-message {
    background: #3d1515;
    border: 1px solid #6b2222;
    color: #ff6b6b;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Dashboard */
.dashboard-container {
    max-width: 700px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: #888;
}

.services {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.service-card {
    flex: 1;
    background: #16213e;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    padding: 1.5rem;
}

.service-card h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status.connected {
    background: #1a3d1a;
    color: #4caf50;
    border: 1px solid #2d5a2d;
}

.status.disconnected {
    background: #3d1515;
    color: #ff6b6b;
    border: 1px solid #6b2222;
}

.service-card .btn {
    margin-top: 0.75rem;
}

.actions {
    text-align: center;
    margin-top: 1.5rem;
}

.hint {
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    margin-top: 1.5rem;
}

#tidal-auth-status {
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

#tidal-auth-status .waiting {
    color: #888;
    font-style: italic;
    margin-top: 0.25rem;
}

/* Playlists */
.playlists-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.playlists-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.playlists-header h1 {
    font-size: 1.5rem;
}

.playlist-table {
    width: 100%;
    border-collapse: collapse;
    background: #16213e;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #2a2a4a;
}

.playlist-table thead {
    background: #0f3460;
}

.playlist-table th,
.playlist-table td {
    padding: 0.75rem 1rem;
    text-align: left;
}

.playlist-table th {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #b0b0b0;
    font-weight: 600;
}

.playlist-table tbody tr {
    border-top: 1px solid #2a2a4a;
    transition: background 0.15s;
}

.playlist-table tbody tr:hover {
    background: #1e2a4a;
}

.playlist-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #6c9bff;
    cursor: pointer;
}

/* Transfer */
.transfer-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.transfer-container h1 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #2a2a4a;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #1a5fb4, #6c9bff);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 1rem;
}

.transfer-log {
    background: #0d1117;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 1rem;
    font-family: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
}

.log-entry {
    padding: 1px 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.log-playlist-start {
    color: #6c9bff;
    font-weight: 600;
    margin-top: 0.5rem;
}

.log-track-found {
    color: #4caf50;
}

.log-track-not-found {
    color: #ff6b6b;
}

.log-tracks-added {
    color: #b0b0b0;
}

.log-tracks-skipped {
    color: #888;
}

.log-playlist-done {
    color: #4caf50;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.log-playlist-error {
    color: #ff6b6b;
    font-weight: 600;
}

.log-complete {
    color: #6c9bff;
    font-weight: 700;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.log-error {
    color: #ff6b6b;
}

/* Transfer Summary */
.transfer-summary {
    background: #16213e;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.transfer-summary h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.summary-row {
    padding: 0.5rem 0;
    border-bottom: 1px solid #2a2a4a;
}

.summary-row:last-child {
    border-bottom: none;
}

/* Utility */
.text-green { color: #4caf50; }
.text-red { color: #ff6b6b; }
.text-gray { color: #888; }

/* Responsive */
@media (max-width: 600px) {
    .services {
        flex-direction: column;
    }

    .dashboard-header,
    .playlists-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .navbar {
        flex-direction: column;
        gap: 0.5rem;
    }
}
