/* 1. Use a more-intuitive box-sizing model */
*, *::before, *::after {
  box-sizing: border-box;
}

/* 2. Remove default margin */
* {
  margin: 0;
}

/* 3. Enable keyword animations */
@media (prefers-reduced-motion: no-preference) {
  html {
    interpolate-size: allow-keywords;
  }
}

body {
  /* 4. Add accessible line-height */
  line-height: 1.5;
  /* 5. Improve text rendering */
  -webkit-font-smoothing: antialiased;
}

/* 6. Improve media defaults */
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

/* 7. Inherit fonts for form controls */
input, button, textarea, select {
  font: inherit;
}

/* 8. Avoid text overflows */
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

/* 9. Improve line wrapping */
p {
  text-wrap: pretty;
}
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
}

/*
  10. Create a root stacking context
*/
#root, #__next {
  isolation: isolate;
}

:root {
    --border: #1f2647;
    --shadow: rgba(0, 0, 0, .35);
    --ink: #4f46e5; /* accent */
    --muted: #94a3b8;
}

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-size: .9em;
    margin: 20px;
    background: #0b1020;
    color: #e5e7eb;
}

.card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 6px 18px var(--shadow);
    background: #0e1328;
}

textarea,
input,
select {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #334155;
    background: #0b1020;
    color: #e5e7eb;
}

button {
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: white;
    cursor: pointer;
}

button.alt {
    background: #334155;
    border-color: #334155;
    color: #e5e7eb;
}

button:disabled {
    opacity: .5;
    cursor: not-allowed;
}

#console {
    height: 160px;
    max-height: 160px;
    background: #0b1020;
    color: #bcd;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    box-sizing: border-box;
}

.row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

@media (min-width: 900px) {
    .row {
        grid-template-columns: 1fr 1fr;
    }
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.tab-btn {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #0b1020;
    color: #e5e7eb;
    cursor: pointer;
}

.tab-btn.active {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.hidden {
    display: none;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

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

@media (min-width: 900px) {
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

.user-playlists-controls {
    align-items: end;
}

.user-playlists-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    justify-content: flex-end;
}

.user-playlists-actions button {
    width: auto;
}

.user-playlists-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.user-playlists-grid.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 24px;
    min-height: 96px;
}

.user-playlist-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #101633;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.user-playlist-card:hover {
    border-color: var(--ink);
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.25);
}

.user-playlist-checkbox {
    width: auto;
    margin-top: 8px;
    cursor: pointer;
}

.user-playlist-card-body {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
    border-radius: 10px;
    padding: 6px 8px;
    border: 1px solid transparent;
    transition: border-color .15s ease, background .15s ease;
    flex-direction: column;
}

.user-playlist-card input:checked + .user-playlist-card-body {
    border-color: var(--ink);
    background: rgba(79, 70, 229, 0.12);
}

.user-playlist-thumb {
    border-radius: 10px;
    overflow: hidden;
    background: #111a3a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-playlist-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-playlist-thumb-placeholder {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    padding: 4px;
}

.user-playlist-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-playlist-name {
    font-weight: 600;
}

.user-playlist-meta {
    font-size: .85em;
    color: var(--muted);
}

.playlist-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

@media (min-width: 768px) {
    .playlist-actions {
        flex-direction: row;
    }
}

.user-playlists-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.muted {
    color: var(--muted);
}

#image-tasks-summary {
    padding-left: 10px;
    font-weight: bold;
    border-left-width: 10px;
    border-style: solid;
    border-top: none;
    border-bottom: none;
    border-right: none;
    margin-left: -18px !important;
}

/* Simple progress bar */
.progress {
    width: 100%;
    height: 10px;
    background: #0b1020;
    border-radius: 9999px;
    overflow: hidden;
    border: 1px solid var(--border);
    margin: 8px 0;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: #2563eb;
    transition: width .2s ease;
}

.pending-albums-section {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pending-albums-top {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 720px) {
    .pending-albums-top {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.pending-albums-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.pending-albums-controls select {
    width: auto;
    min-width: 70px;
}

.pending-albums-pagination {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.pending-albums-list {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: #0b1020;
    max-height: 240px;
    overflow-y: auto;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.pending-albums-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: flex-start;
}

.pending-albums-select-all {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.pending-albums-select-all input {
    width: auto;
    cursor: pointer;
}

.pending-albums-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 10px;
    background: #101633;
}

.pending-albums-item input {
    width: auto;
}

.pending-albums-footer {
    display: flex;
    justify-content: flex-end;
}

/* Floating job indicator (top-right) */
.job-indicator {
    
    width: 36px;
    height: 36px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    background: #0e1328;
    border: 3px solid #334155;
    box-shadow: 0 2px 6px var(--shadow);
    color: #fff;
    font-weight: 700;
    font-size: 18px;
}

.job-indicator.spinning {
    border-top-color: white;
    animation: spin 1s linear infinite;
    background: #1d10fd;
}

.job-indicator.done {
    border-color: #10b981;
    background: #10b981;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Job queue list above console */
.job-queue {
    margin-bottom: 8px;
    padding: 6px 8px;
    background: #0b1020;
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 160px;
    height: 160px;
    overflow: auto;
    color: white;
}

.job-item {
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    padding: 2px 0;
    font-weight: bold;
}

.job-item.status-queued {
    color: #a6a7a8;
}

.job-item.status-running {
    color: #75a0ff;
}

.job-item.status-done {
    color: #10b981;
}

.job-item.status-error {
    color: #dc2626;
}

/* Spotify status banner */
.status-ok {
    color: #10b981; /* green */
    font-weight: 600;
}
.status-error {
    color: #dc2626; /* red */
    font-weight: 600;
}


section.header {
    position: absolute;
    top: 0;
    left: 70px;
    margin-top: 15px;
    
}

.brand {
     position: absolute;
    top: -75px;
    left: 6px;
    margin-top: 15px;
    width: 500px;
}

#spotify-status{
    position: absolute;
    top: 20px;
    font-size: 10px;
}

.brand-title {
    position: absolute;
    width: 300px;
    top: 0;
}
#spotify-status {
    width: 300px;
}



button:hover { background-color: #6d64ff; border-color: #6d64ff; }
button { transition: all 120ms ease-in; }
button.tab-btn:hover { background-color: #1f2647; color: white; border-color: #1f2647; }
button.tab-btn.active:hover { background-color: #3f3ad6; border-color: #3f3ad6; color: white; }

/* --- Layout Enhancements: Sidebar + Drawer --- */
/* Move job indicator to top-right to avoid sidebar overlap */


.app-shell { display:grid; grid-template-columns: 240px 1fr; gap:16px; align-items:start; }
.sidebar { background:#0e1328; border:1px solid var(--border); border-radius:14px; padding:14px; position:sticky; top:20px; height:calc(100vh - 40px); display:flex; flex-direction:column; }
.brand { display:flex; gap:10px; align-items:center; margin-bottom:14px; }
.badge { display:inline-block; background:#1d10fd; color:#fff; font-weight:700; border-radius:10px; padding:8px 8px; }
.brand-title { font-weight:700; }
.brand-sub { font-size:12px; margin-top:2px; }
.nav { display:flex; flex-direction:column; gap:8px; margin-top:6px; }
.nav-item { text-align:left; padding:10px 12px; border-radius:10px; border:1px solid var(--border); background:#0b1020; color:#e5e7eb; cursor:pointer; }
.nav-item.active { background:var(--ink); border-color:var(--ink); color:#fff; }
.nav-item:hover { background:#1f2647; border-color:#1f2647; }
/* .sidebar-footer { margin-top:auto; padding-top:12px; border-top:1px solid var(--border); color:var(--muted); font-size:12px; } */
.content { min-height:60vh; }

/* Bottom Drawer */
.drawer { position:fixed; left:20px; right:20px; bottom:20px; background:#0e1328; border:1px solid var(--border); border-radius:14px; box-shadow:0 -10px 25px var(--shadow); overflow:hidden; height:280px; transition:height 160ms ease; }
.drawer-header { display:flex; align-items:center; gap:10px; padding:8px 10px; border-bottom:1px solid var(--border); }
.drawer-title { font-weight:700; }
.drawer-actions { margin-left:auto; }
.drawer-toggle { padding: 5px 10px; border-radius:6px; cursor:pointer; border:1px solid var(--border); background:#0b1020; }
.drawer-body { padding:10px; }
.drawer-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.drawer.closed { height:62px; }
.drawer.closed .drawer-body { display:none; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position:static; height:auto; }
  .drawer-grid { grid-template-columns:1fr; }
}


.drawer-title > span {
    display: inline-block;
}
.sidebar-footer {
    display: inline-block;
}

body {
    overflow: hidden;
}


.animated-border {
  
  display: grid;
  color: white;
  text-shadow: 0 1px 0 #000;
  --border-angle: 0turn;
  --main-bg: conic-gradient(
      from var(--border-angle),
      #213,
      #112 5%,
      #112 60%,
      #213 95%
    );
  border: solid 1px transparent;
  border-radius: 2em;
  --gradient-border: conic-gradient(from var(--border-angle), transparent 25%, #08f, #f03 99%, transparent);
  background: var(--main-bg) padding-box, var(--gradient-border) border-box, var(--main-bg) border-box;
  background-position: center center;
  -webkit-animation: bg-spin 3s linear infinite;
          animation: bg-spin 3s linear infinite;
}
@-webkit-keyframes bg-spin {
  to {
    --border-angle: 1turn;
  }
}
@keyframes bg-spin {
  to {
    --border-angle: 1turn;
  }
}
/* .animated-border:hover {
  -webkit-animation-play-state: paused;
          animation-play-state: paused;
} */

@property --border-angle {
  syntax: "<angle>";
  inherits: true;
  initial-value: 0turn;
}

.drawer-actions > button {
    border-radius: 999px;
    
    
}



/* =========
   Theme vars
   ========= */
:root {
  --field-bg: #ffffff;
  --field-text: #111827;
  --field-border: #d1d5db;
  --field-placeholder: #9ca3af;
  --focus-ring: rgba(99, 102, 241, 0.35); /* indigo glow */
  --focus-border: #6366f1;

  --sb-size: 10px;
  --sb-track: #f3f4f6;
  --sb-thumb: #c7cdd6;
  --sb-thumb-hover: #aeb6c2;

  --radius: 10px;
}

/* Auto-dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --field-bg: #0b0f14;
    --field-text: #e5e7eb;
    --field-border: #263241;
    --field-placeholder: #6b7280;
    --focus-ring: rgba(99, 102, 241, 0.45);
    --focus-border: #8b91ff;

    --sb-track: #121821;
    --sb-thumb: #2a3a4e;
    --sb-thumb-hover: #3a506b;
  }
}

/* =========================
   Textarea + scrollable div
   ========================= */

/* Base text area styling */
textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--field-text);
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

textarea::placeholder {
  color: var(--field-placeholder);
}

textarea:focus {
  border-color: var(--focus-border);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

/* Disabled/readonly visuals (optional) */
textarea:disabled,
textarea[readonly] {
  opacity: .7;
  cursor: not-allowed;
}

/* Any div that can scroll */
.scrollable {
  max-height: 260px;        /* adjust as needed */
  overflow: auto;           /* ensures scrollbars appear */
  padding: 10px;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--field-text);
}

/* ========================
   Custom scrollbar styling
   - WebKit/Blink (Chrome, Edge, Safari, Opera)
   - Firefox fallbacks
   ======================== */

/* Firefox */
textarea,
.scrollable {
  scrollbar-width: thin; /* auto | thin | none */
  scrollbar-color: var(--sb-thumb) var(--sb-track); /* thumb track */
}

/* WebKit/Blink */
textarea::-webkit-scrollbar,
.scrollable::-webkit-scrollbar {
  width: var(--sb-size);
  height: var(--sb-size);
}

textarea::-webkit-scrollbar-track,
.scrollable::-webkit-scrollbar-track {
  background: var(--sb-track);
  border-radius: calc(var(--radius) - 2px);
}

textarea::-webkit-scrollbar-thumb,
.scrollable::-webkit-scrollbar-thumb {
  background: var(--sb-thumb);
  border-radius: 999px;
  border: 2px solid var(--sb-track); /* gives the thumb some breathing room */
}

textarea::-webkit-scrollbar-thumb:hover,
.scrollable::-webkit-scrollbar-thumb:hover {
  background: var(--sb-thumb-hover);
}

textarea::-webkit-scrollbar-corner,
.scrollable::-webkit-scrollbar-corner {
  background: transparent;
}

/* High-contrast safety */
@media (forced-colors: active) {
  textarea,
  .scrollable {
    border: 1px solid CanvasText;
  }
}


#console {
    resize: none;
    cursor: default;
}


.relative {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.playlist-textarea {
    
    flex: 0 0 10%;
    textarea {
        min-height: initial;
        height: 100px;
    }
}

.playlist-gallery {
    flex: 0 0 50%;
    
}

#user-playlists-results {
    max-height: 500px;
    overflow-y: scroll; 
}


.user-playlist-checkbox {
    display: none;
}


.user-playlist-card:has(.user-playlist-checkbox:checked) {
  background-color: rgba(29, 185, 84, 0.15) !important;
  border: 2px solid #1db954;
}

.user-playlist-name {
  display: -webkit-box;          /* required for line clamp */
  -webkit-box-orient: vertical;  /* vertical flow */
  -webkit-line-clamp: 3;         /* show 2 lines max */
  overflow: hidden;              /* hide extra text */
  text-overflow: ellipsis;       /* add "..." */
  cursor: default;
}