/* ========================================
   Sir Nautilus — Dark Theme Stylesheet
   ======================================== */

/* ---------- Variables ---------- */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-card: rgba(22, 27, 34, 0.85);
    --bg-hover: rgba(48, 54, 61, 0.5);

    --border: #30363d;
    --border-light: rgba(255, 255, 255, 0.06);

    --accent: #5865F2;
    --accent-hover: #4752c4;
    --accent-glow: rgba(88, 101, 242, 0.25);
    --accent-light: #7289da;

    --discord: #5865F2;

    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;

    --success: #3fb950;
    --error: #f85149;
    --warning: #d29922;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 20px var(--accent-glow);

    --transition: all 0.2s ease;
    --transition-slow: all 0.4s ease;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: var(--font);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-light);
}

img {
    max-width: 100%;
    display: block;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ---------- Utility ---------- */
.text-muted {
    color: var(--text-secondary);
}

.text-center {
    text-align: center;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-glow);
    color: #fff;
}

.btn-discord {
    background: var(--discord);
    color: #fff;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
}
.btn-discord:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-glow);
    color: #fff;
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
}
.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}
.btn-outline:hover {
    background: rgba(88, 101, 242, 0.1);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    border-radius: var(--radius-lg);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}
.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ---------- Inputs ---------- */
.input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}
.input::placeholder {
    color: var(--text-muted);
}
.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ---------- Loader ---------- */
.loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Toast ---------- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 13px;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 3.7s forwards;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.toast.toast-error { border-left: 3px solid var(--error); }
.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-info { border-left: 3px solid var(--accent); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ==========================================
   LANDING PAGE
   ========================================== */
.landing {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(88, 101, 242, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(114, 137, 218, 0.06) 0%, transparent 50%),
        var(--bg-primary);
}

.landing-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    font-size: 24px;
    color: rgba(88, 101, 242, 0.12);
    animation: float linear infinite;
}
.particle-1 { left: 10%; animation-duration: 18s; animation-delay: 0s; top: -30px; }
.particle-2 { left: 25%; animation-duration: 22s; animation-delay: 3s; top: -30px; font-size: 18px; }
.particle-3 { left: 50%; animation-duration: 16s; animation-delay: 7s; top: -30px; }
.particle-4 { left: 70%; animation-duration: 20s; animation-delay: 2s; top: -30px; font-size: 30px; }
.particle-5 { left: 85%; animation-duration: 24s; animation-delay: 5s; top: -30px; }
.particle-6 { left: 40%; animation-duration: 19s; animation-delay: 10s; top: -30px; font-size: 16px; }

@keyframes float {
    0% { transform: translateY(-30px) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

.landing-content {
    text-align: center;
    padding: 40px 20px;
    max-width: 800px;
    position: relative;
    z-index: 1;
}

.landing-logo {
    margin-bottom: 24px;
    animation: fadeUp 0.6s ease;
}

.landing-title {
    font-size: 48px;
    font-weight: 800;
    background: linear-gradient(135deg, #e6edf3, #5865F2);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
    animation: fadeUp 0.6s ease 0.1s both;
}

.landing-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 48px;
    animation: fadeUp 0.6s ease 0.2s both;
}

.landing-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 48px;
    animation: fadeUp 0.6s ease 0.3s both;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 28px 20px;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}
.feature-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(88, 101, 242, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 20px;
    color: var(--accent);
}

.feature-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}
.feature-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.landing-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeUp 0.6s ease 0.4s both;
}

.landing-footer {
    margin-top: 48px;
    font-size: 12px;
    color: var(--text-muted);
    animation: fadeUp 0.6s ease 0.5s both;
}

@keyframes fadeUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ==========================================
   APP LAYOUT (Player page)
   ========================================== */
.app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse at 10% 80%, rgba(88, 101, 242, 0.05) 0%, transparent 40%),
        radial-gradient(ellipse at 90% 20%, rgba(114, 137, 218, 0.04) 0%, transparent 40%),
        var(--bg-primary);
}

/* ---------- Header ---------- */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 100;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 16px;
}
.header-logo:hover {
    color: var(--text-primary);
}

.header-guild {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    font-size: 13px;
    font-weight: 500;
}

.guild-icon-sm {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

/* ---------- Views ---------- */
.view {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-center {
    text-align: center;
    padding: 40px 20px;
    max-width: 700px;
    width: 100%;
}

.view-center h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.empty-state {
    animation: fadeUp 0.4s ease;
}

.empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(88, 101, 242, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 32px;
    color: var(--accent);
}

/* ---------- Guild Grid ---------- */
.guild-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    margin-top: 28px;
}

.guild-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px 12px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    backdrop-filter: blur(6px);
}
.guild-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.guild-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    margin: 0 auto 12px;
    object-fit: cover;
    background: var(--bg-tertiary);
}

.guild-card-initial {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    margin: 0 auto 12px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-secondary);
}

.guild-card-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================
   PLAYER LAYOUT
   ========================================== */
.player-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 320px 1fr 300px;
    gap: 0;
    overflow: hidden;
    min-height: 0;
}

/* ---------- Panels ---------- */
.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.panel-header h3 {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

/* ---------- Queue Panel ---------- */
.panel-queue {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Queue header */
.queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.queue-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.queue-header-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.queue-header-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(88, 101, 242, 0.12);
    padding: 1px 7px;
    border-radius: var(--radius-full);
    line-height: 1.5;
}

.queue-header-actions {
    display: flex;
    gap: 4px;
}

.queue-header-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: var(--transition);
}
.queue-header-btn:hover {
    background: rgba(248, 81, 73, 0.12);
    color: var(--error);
}

/* Queue list */
.queue-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 0;
}

/* Single queue item */
.queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    margin: 0 6px;
    border-radius: var(--radius-sm);
    cursor: default;
    transition: background 0.15s ease, opacity 0.2s ease;
    position: relative;
    user-select: none;
}
.queue-item[draggable="true"] {
    cursor: grab;
}
.queue-item[draggable="true"]:active {
    cursor: grabbing;
}
.queue-item:hover {
    background: var(--bg-hover);
}

/* Current playing track */
.queue-item.active {
    background: rgba(88, 101, 242, 0.08);
}
.queue-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}

/* Drag states */
.queue-item.dragging {
    opacity: 0.3;
}
.queue-item.drag-over {
    background: rgba(88, 101, 242, 0.1);
    box-shadow: inset 0 -2px 0 0 var(--accent);
}

/* Track index number / playing icon */
.queue-item-index {
    width: 20px;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    line-height: 1;
}
.queue-item.active .queue-item-index {
    color: var(--accent);
}

/* Track thumbnail */
.queue-item-thumb {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

/* Track info block */
.queue-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.queue-item-title {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    line-height: 1.3;
}
.queue-item.active .queue-item-title {
    color: var(--accent-light);
}

.queue-item-duration {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Hover action buttons */
.queue-item-actions {
    display: flex;
    align-items: center;
    gap: 1px;
    opacity: 0;
    transition: opacity 0.12s ease;
    flex-shrink: 0;
}
.queue-item:hover .queue-item-actions {
    opacity: 1;
}

.queue-action-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
}
.queue-action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.queue-action-remove:hover {
    background: rgba(248, 81, 73, 0.15) !important;
    color: var(--error) !important;
}

/* Empty state */
.queue-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 48px 20px;
    color: var(--text-muted);
}
.queue-empty i {
    font-size: 28px;
    opacity: 0.25;
}
.queue-empty span {
    font-size: 13px;
}

/* ---------- Player Panel ---------- */
.panel-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 24px 20px;
    overflow-y: auto;
    gap: 20px;
}

.now-playing {
    text-align: center;
    animation: fadeUp 0.4s ease;
}

.np-thumbnail-wrap {
    position: relative;
    width: 260px;
    height: 260px;
    margin: 0 auto 20px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--bg-tertiary);
}

.np-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-slow);
}

/* Equalizer overlay */
.np-equalizer {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 24px;
}
.np-equalizer span {
    display: block;
    width: 4px;
    background: var(--accent);
    border-radius: 2px;
    animation: eq-bar 0.8s ease-in-out infinite alternate;
}
.np-equalizer span:nth-child(1) { height: 8px; animation-delay: 0s; }
.np-equalizer span:nth-child(2) { height: 16px; animation-delay: 0.15s; }
.np-equalizer span:nth-child(3) { height: 12px; animation-delay: 0.3s; }
.np-equalizer span:nth-child(4) { height: 20px; animation-delay: 0.45s; }
.np-equalizer span:nth-child(5) { height: 10px; animation-delay: 0.6s; }

@keyframes eq-bar {
    0% { height: 4px; }
    100% { height: 22px; }
}

.np-info {
    max-width: 360px;
    margin: 0 auto;
}

.np-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.np-duration {
    font-size: 13px;
}

/* ---------- Controls ---------- */
.player-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-control {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 16px;
}
.btn-control:hover {
    background: var(--bg-hover);
    color: var(--accent);
    transform: scale(1.08);
}
.btn-control:active {
    transform: scale(0.95);
}

.btn-control-main {
    width: 56px;
    height: 56px;
    background: var(--accent);
    font-size: 20px;
}
.btn-control-main:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-glow);
    color: #fff;
}

/* ---------- Volume ---------- */
.volume-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 260px;
}

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 6px var(--accent-glow);
    transition: var(--transition);
}
.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}
.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.volume-value {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 32px;
    text-align: right;
}

/* ---------- GIF ---------- */
.player-gif {
    border-radius: var(--radius-md);
    overflow: hidden;
    max-width: 300px;
    opacity: 0.85;
    transition: var(--transition);
}
.player-gif:hover {
    opacity: 1;
}
.player-gif img {
    width: 100%;
    border-radius: var(--radius-md);
}

/* ---------- Add Track Panel ---------- */
.panel-add {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
}

.add-track-form {
    padding: 20px;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1100px) {
    .player-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    .panel-queue {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 240px;
    }
    .panel-add {
        border-left: none;
        border-top: 1px solid var(--border);
    }
    .queue-item-thumb {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 640px) {
    .landing-features {
        grid-template-columns: 1fr;
    }
    .landing-title {
        font-size: 32px;
    }
    .landing-subtitle {
        font-size: 15px;
    }
    .np-thumbnail-wrap {
        width: 200px;
        height: 200px;
    }
    .header {
        padding: 0 12px;
    }
}
