/* ─── VARIABLES ─────────────────────────────────────────────── */
:root {
  --blue:       #2563eb;
  --blue-h:     #1d4ed8;
  --blue-light: #eff6ff;
  --blue-mid:   #dbeafe;
  --green:      #16a34a;
  --green-h:    #15803d;
  --green-light:#dcfce7;
  --red:        #dc2626;
  --red-h:      #b91c1c;
  --red-light:  #fee2e2;
  --border:     #e5e7eb;
  --text:       #111827;
  --muted:      #6b7280;
  --surface:    #f9fafb;
  --white:      #ffffff;
  --radius:     10px;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10);
}

/* ─── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Plus Jakarta Sans', sans-serif; background: var(--surface); color: var(--text); min-height: 100vh; font-size: 14px; line-height: 1.6; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, button { font-family: inherit; }

/* ─── UTILITIES ──────────────────────────────────────────────── */
.mb-14 { margin-bottom: 14px; }
.mb-20 { margin-bottom: 20px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.btn-full { width: 100%; }

/* ─── TOAST ──────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1f2937; color: #fff;
  font-size: 13px; font-weight: 500;
  padding: 10px 22px; border-radius: 99px;
  z-index: 9999; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── NAVBAR ─────────────────────────────────────────────────── */
.navbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow);
}
.logo { font-size: 19px; font-weight: 800; color: var(--blue); letter-spacing: -.8px; text-decoration: none; }
.logo span { color: var(--text); }
.nav-right { display: flex; align-items: center; gap: 8px; }
.nav-link { font-size: 13px; color: var(--muted); padding: 6px 12px; border-radius: 7px; transition: background .15s, color .15s; }
.nav-link:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--blue-mid); color: var(--blue);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; border: 2px solid var(--blue-mid);
  transition: border-color .15s;
}
.nav-avatar:hover { border-color: var(--blue); }

/* ─── BUTTONS ────────────────────────────────────────────────── */
.btn { border: none; border-radius: 8px; padding: 9px 18px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; gap: 5px; }
.btn-primary  { background: var(--blue);  color: #fff; }
.btn-primary:hover  { background: var(--blue-h); }
.btn-outline  { background: var(--white); color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover  { border-color: #9ca3af; background: var(--surface); }
.btn-success  { background: var(--green); color: #fff; }
.btn-success:hover  { background: var(--green-h); }
.btn-danger   { background: var(--red);   color: #fff; }
.btn-danger:hover   { background: var(--red-h); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ─── HERO ───────────────────────────────────────────────────── */
.hero { background: var(--white); border-bottom: 1px solid var(--border); padding: 36px 24px 32px; text-align: center; }
.hero h1 { font-size: 28px; font-weight: 800; letter-spacing: -.8px; margin-bottom: 8px; }
.hero h1 span { color: var(--blue); }
.hero p { font-size: 14px; color: var(--muted); max-width: 480px; margin: 0 auto; }

/* ─── CONTAINER ──────────────────────────────────────────────── */
.container { max-width: 820px; margin: 0 auto; padding: 28px 16px; }

/* ─── CARD ───────────────────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h2 { font-size: 15px; font-weight: 700; }
.card-header span { font-size: 12px; color: var(--muted); }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-footer label { font-size: 12px; color: var(--muted); font-weight: 500; }
.card-footer select { font-size: 12px; border: 1px solid var(--border); border-radius: 7px; padding: 5px 10px; background: var(--white); color: var(--text); cursor: pointer; }

/* ─── DROP ZONE ──────────────────────────────────────────────── */
.drop-zone {
  margin: 16px; padding: 48px 24px 36px; text-align: center;
  cursor: pointer; border: 2px dashed #d1d5db; border-radius: 10px;
  transition: background .2s, border-color .2s;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--blue); background: var(--blue-light); }
.drop-icon { font-size: 44px; display: block; margin-bottom: 14px; }
.drop-zone h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.drop-zone p  { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.drop-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
input[type="file"] { display: none; }

/* URL ROW */
.url-row { display: none; align-items: center; gap: 10px; padding: 0 20px 16px; }
.url-row.open { display: flex; }
.url-row input { flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 9px 14px; font-size: 13px; color: var(--text); outline: none; transition: border-color .15s; }
.url-row input:focus { border-color: var(--blue); }

/* ─── QUEUE ──────────────────────────────────────────────────── */
.queue-section { display: none; margin-bottom: 20px; }
.queue-section.show { display: block; }
.queue-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.queue-header h3 { font-size: 14px; font-weight: 700; }
.queue-list { display: flex; flex-direction: column; gap: 8px; }
.queue-item { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); }
.q-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 7px; border: 1px solid var(--border); flex-shrink: 0; }
.q-info { flex: 1; min-width: 0; }
.q-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.q-status { font-size: 11px; color: var(--muted); margin-top: 3px; }
.q-status.uploading { color: var(--blue); }
.q-status.done  { color: var(--green); }
.q-status.error { color: var(--red); }
.progress-wrap { height: 4px; background: #e5e7eb; border-radius: 99px; margin-top: 6px; overflow: hidden; }
.progress-bar { height: 4px; background: var(--blue); border-radius: 99px; width: 0; transition: width .2s; }
.progress-bar.done-bar { background: var(--green); }
.btn-remove { background: none; border: none; color: #9ca3af; cursor: pointer; font-size: 22px; line-height: 1; padding: 4px 6px; border-radius: 5px; flex-shrink: 0; }
.btn-remove:hover { color: var(--red); background: var(--red-light); }

/* ─── RESULTS ────────────────────────────────────────────────── */
.results-section { display: none; }
.results-section.show { display: block; }
.results-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.results-header h3 { font-size: 14px; font-weight: 700; }
.result-img-zone { background: #f1f5f9; text-align: center; padding: 20px; border-bottom: 1px solid var(--border); }
.result-img-zone img { max-height: 220px; max-width: 100%; border-radius: 8px; object-fit: contain; }
.result-body { padding: 16px 18px; }
.result-filename { font-size: 14px; font-weight: 700; margin-bottom: 12px; }

/* TABS */
.tab-bar { display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 3px; margin-bottom: 14px; width: fit-content; }
.tab-btn { background: none; border: none; font-size: 12px; font-weight: 600; padding: 5px 14px; border-radius: 6px; cursor: pointer; color: var(--muted); transition: all .15s; }
.tab-btn.active { background: var(--white); color: var(--text); box-shadow: var(--shadow); }

/* LINK ROWS */
.link-rows { display: flex; flex-direction: column; gap: 8px; }
.link-row { display: flex; align-items: center; gap: 8px; }
.link-label { font-size: 11px; font-weight: 600; color: var(--muted); min-width: 100px; white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.link-input { flex: 1; border: 1px solid var(--border); border-radius: 7px; padding: 7px 10px; font-size: 11px; background: var(--surface); color: var(--text); font-family: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; outline: none; min-width: 0; }
.link-input:focus { border-color: var(--blue); background: var(--white); }
.btn-copy { background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: 7px 14px; font-size: 11px; font-weight: 600; cursor: pointer; color: var(--text); white-space: nowrap; transition: all .15s; }
.btn-copy:hover  { background: var(--blue-mid); color: var(--blue); border-color: #93c5fd; }
.btn-copy.copied { background: var(--green-light); color: var(--green); border-color: #86efac; }

/* ─── AUTH PAGE ──────────────────────────────────────────────── */
.auth-body { background: var(--surface); display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-wrap { background: var(--white); border: 1px solid var(--border); border-radius: 16px; padding: 32px 28px; width: 100%; max-width: 400px; box-shadow: var(--shadow-md); }
.auth-logo { display: block; font-size: 22px; font-weight: 800; color: var(--blue); letter-spacing: -.8px; text-decoration: none; margin-bottom: 24px; }
.auth-logo span { color: var(--text); }
.auth-tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 4px; margin-bottom: 24px; }
.auth-tab { flex: 1; background: none; border: none; border-radius: 7px; padding: 8px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); transition: all .15s; }
.auth-tab.active { background: var(--white); color: var(--text); box-shadow: var(--shadow); }
.auth-switch { font-size: 13px; color: var(--muted); text-align: center; margin-top: 16px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-group small { color: var(--muted); font-weight: 400; }
.form-group input { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 13px; color: var(--text); outline: none; transition: border-color .15s; }
.form-group input:focus { border-color: var(--blue); }
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 44px; }
.pass-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 16px; color: var(--muted); padding: 0; line-height: 1; }

/* ─── DASHBOARD STATS ────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; box-shadow: var(--shadow); }
.stat-num { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.5px; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }

/* ─── DASHBOARD TABS ─────────────────────────────────────────── */
.dash-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.dash-tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 10px 16px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); transition: all .15s; margin-bottom: -1px; }
.dash-tab:hover { color: var(--text); }
.dash-tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ─── SECTION HEADER ─────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.section-header h3 { font-size: 15px; font-weight: 700; }

/* ─── IMAGE GRID ─────────────────────────────────────────────── */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.img-card { background: var(--white); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.img-thumb-wrap { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--surface); }
.img-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; display: block; }
.img-thumb-wrap:hover img { transform: scale(1.05); }
.img-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  opacity: 0; transition: opacity .2s;
}
.img-thumb-wrap:hover .img-overlay { opacity: 1; }
.img-action { background: rgba(255,255,255,.9); border: none; border-radius: 7px; width: 34px; height: 34px; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.img-action:hover { background: #fff; }
.img-action.danger:hover { background: var(--red-light); }
.img-meta { padding: 10px 12px; }
.img-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.img-info { font-size: 10px; color: var(--muted); }
.copy-panel { padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface); }

/* ─── ALBUM GRID ─────────────────────────────────────────────── */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 14px; }
.album-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.album-cover { height: 120px; background: var(--blue-mid); display: flex; align-items: center; justify-content: center; font-size: 36px; }
.album-info { padding: 12px 14px 8px; }
.album-name { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.album-meta { font-size: 11px; color: var(--muted); }
.album-actions { display: flex; gap: 8px; padding: 0 14px 14px; }
.album-pick-btn { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 13px; cursor: pointer; font-family: inherit; margin-bottom: 8px; transition: background .15s; }
.album-pick-btn:hover { background: var(--blue-light); color: var(--blue); }
.album-pick-btn:last-child { color: var(--muted); }

/* ─── PROFILE ────────────────────────────────────────────────── */
.avatar-section { display: flex; align-items: center; gap: 16px; }
.avatar-big { width: 60px; height: 60px; border-radius: 50%; background: var(--blue-mid); color: var(--blue); font-size: 20px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ─── MODAL ──────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 1000;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box { background: var(--white); border: 1px solid var(--border); border-radius: 16px; padding: 24px; width: 100%; max-width: 380px; box-shadow: var(--shadow-md); }
.modal-box h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }

/* ─── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 22px; }
  .link-label { min-width: 70px; font-size: 10px; }
  .navbar .nav-link { display: none; }
  .img-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 400px) {
  .auth-wrap { padding: 24px 18px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
