:root {
  color-scheme: dark;
  --bg: #0f111a;
  --panel: rgba(26, 29, 41, 0.65);
  --panel-solid: #1a1d29;
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --text-main: #f1f3f5;
  --text-muted: #8b92a5;
  --primary: #4f87ff;
  --primary-hover: #6b9cff;
  --danger: #ff5c5c;
  --ok: #20c997;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg);
  background-image: radial-gradient(circle at 15% 50%, rgba(79, 135, 255, 0.08), transparent 25%),
                    radial-gradient(circle at 85% 30%, rgba(32, 201, 151, 0.05), transparent 25%);
  color: var(--text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--panel);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}

.logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(79, 135, 255, 0.3);
}

.brand h1 { font-size: 20px; font-weight: 600; letter-spacing: 0.5px; }

.nav-section { margin-bottom: 32px; flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.bottom-section { flex: none; margin-bottom: 0; }

.nav-title {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-menu {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
}

.nav-menu::-webkit-scrollbar { width: 4px; }
.nav-menu::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 4px; }

.album-item {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.album-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.album-item.active {
  background: rgba(79, 135, 255, 0.15);
  color: var(--primary);
  font-weight: 500;
}

/* Forms & Inputs */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }

input[type="text"], input[type="password"], .styled-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

input:focus, .styled-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 135, 255, 0.2);
}

/* Buttons */
.btn {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); transform: translateY(-1px); }

.btn.secondary { background: rgba(255, 255, 255, 0.05); color: var(--text-main); border: 1px solid var(--border); }
.btn.secondary:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--border-hover); }

.btn.text-btn { background: transparent; padding: 8px 12px; }
.btn.text-btn:hover { background: rgba(255, 255, 255, 0.05); }
.danger-text { color: var(--danger); }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.2s;
}
.icon-btn:hover { color: var(--text-main); background: rgba(255,255,255,0.05); }

.btn-group { display: flex; gap: 8px; margin-bottom: 8px; }
.btn-group .btn { flex: 1; }
/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(15, 17, 26, 0.4);
}

.top-header {
  height: 72px;
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: rgba(26, 29, 41, 0.4);
  backdrop-filter: blur(10px);
}

.header-left, .header-right { display: flex; align-items: center; gap: 16px; }

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.status-dot::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}
.status-dot.ok { color: var(--text-main); }
.status-dot.ok::before { background: var(--ok); box-shadow: 0 0 8px rgba(32,201,151,0.5); }

.search-bar { position: relative; width: 260px; }
.search-bar input { width: 100%; padding-right: 72px; border-radius: 20px; }
.search-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); padding: 6px 12px; border-radius: 16px; background: rgba(79, 135, 255, 0.16); color: var(--primary); }

.styled-select { width: auto; border-radius: 20px; padding: 8px 16px; }

.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

/* Upload Zone */
.upload-zone { border: 1px dashed rgba(79, 135, 255, 0.3); background: rgba(79, 135, 255, 0.02); }
.upload-header h2 { font-size: 16px; font-weight: 500; margin-bottom: 20px; }
.highlight { color: var(--primary); }

.upload-controls {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.file-select-wrapper { display: flex; align-items: center; gap: 12px; }
.hint { font-size: 13px; color: var(--text-muted); }

.options-group { display: flex; gap: 16px; }
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.checkbox-label:hover { color: var(--text-main); }

.upload-log {
  font-size: 13px; color: var(--text-muted);
  background: rgba(0,0,0,0.2); border-radius: var(--radius-md);
  padding: 12px; max-height: 100px; overflow-y: auto;
}
.upload-log.empty { border: 1px dashed var(--border); background: transparent; text-align: center; color: var(--border-hover); }

/* Gallery */
.bulk-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid rgba(79, 135, 255, 0.22);
  border-radius: var(--radius-lg);
  background: rgba(18, 22, 34, 0.86);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}
.bulk-toolbar span {
  margin-right: auto;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
}


.gallery-section { display: flex; flex-direction: column; gap: 24px; flex: 1; }
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  align-items: start;
  gap: 20px;
}
.image-grid.empty {
  display: block;
  min-height: 240px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}
.empty-panel {
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-card {
  position: relative;
  background: rgba(26, 29, 41, 0.92);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  box-shadow: 0 10px 28px rgba(0,0,0,0.18);
}
.image-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 34px rgba(0,0,0,0.28);
  border-color: rgba(79, 135, 255, 0.35);
}
.image-card.selected {
  border-color: rgba(79, 135, 255, 0.85);
  box-shadow: 0 0 0 2px rgba(79, 135, 255, 0.18), 0 18px 34px rgba(0,0,0,0.28);
}
.select-box {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: rgba(5, 7, 12, 0.7);
  border: 1px solid rgba(255,255,255,0.18);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.select-box input { display: none; }
.select-box span {
  width: 14px;
  height: 14px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.55);
}
.select-box input:checked + span {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: inset 0 0 0 3px rgba(5,7,12,0.45);
}

.image-preview {
  display: block;
  background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  border-bottom: 1px solid var(--border);
}
.image-thumb {
  width: 100%;
  height: 220px;
  object-fit: contain;
  display: block;
  background: #0a0c12;
}

.image-body { padding: 14px 14px 12px; }
.image-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.image-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.format-pill {
  flex: none;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #b9c7ff;
  border: 1px solid rgba(79, 135, 255, 0.28);
  background: rgba(79, 135, 255, 0.1);
  border-radius: 999px;
  padding: 3px 8px;
}
.image-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}
.image-details div { min-width: 0; }
.image-details dt {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.image-details dd {
  font-size: 12px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.image-grid.compact .image-details { display: none; }
.image-grid.compact .image-body { padding-bottom: 14px; }
.image-grid.compact .image-thumb { height: 190px; }
.image-grid.compact .image-title-row { margin-bottom: 0; }

.image-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.14);
}
.action-btn {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.action-btn:last-child { border-right: 0; }
.action-btn:hover { background: rgba(255,255,255,0.055); color: var(--text-main); }
.action-btn.danger { color: #ff8b8b; }
.action-btn.danger:hover { background: rgba(255,92,92,0.12); color: #ffb0b0; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 20px 0; }
.page-text { font-size: 14px; font-weight: 500; }


.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 32px 26px;
  border-top: 1px solid var(--border);
  background: rgba(10, 12, 19, 0.55);
}
.footer-text-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
#footerText {
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-link-btn { white-space: nowrap; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(8px);
}
.modal-card {
  position: relative;
  width: min(560px, 100%);
  border: 1px solid rgba(79, 135, 255, 0.18);
  border-radius: 22px;
  background: rgba(20, 24, 36, 0.96);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  padding: 24px;
}
.modal-header h2 {
  margin: 0;
  font-size: 24px;
}
.modal-body {
  margin-top: 14px;
  color: var(--text-muted);
  line-height: 1.8;
  font-size: 15px;
}
.modal-body p { margin: 0 0 10px; }
.modal-body p:last-child { margin-bottom: 0; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel-solid); border: 1px solid var(--border);
  padding: 12px 24px; border-radius: 30px; box-shadow: var(--shadow);
  z-index: 1000; font-size: 14px; animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }
.hidden { display: none; }

@media (max-width: 960px) {
  .app-container { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }
  .sidebar { width: 100%; max-height: none; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { margin-bottom: 20px; }
  .nav-section { flex: none; max-height: 220px; }
  .bottom-section { max-height: none; }
  .main-content { overflow: visible; }
  .top-header { height: auto; padding: 18px 20px; align-items: stretch; flex-direction: column; gap: 14px; }
  .header-left, .header-right { width: 100%; flex-wrap: wrap; }
  .search-bar { width: 100%; }
  .content-body { padding: 20px; }
  .upload-controls { align-items: stretch; flex-direction: column; gap: 14px; }
  .file-select-wrapper, .options-group { flex-wrap: wrap; }
  .image-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .app-footer { padding: 18px 20px 24px; flex-direction: column; align-items: stretch; }
  .footer-text-group { justify-content: space-between; }
}

@media (max-width: 520px) {
  .sidebar { padding: 20px 16px; }
  .content-body { padding: 16px; }
  .image-grid { grid-template-columns: 1fr; }
  .image-thumb { height: 200px; }
  .image-details { grid-template-columns: 1fr; }
  .image-actions { grid-template-columns: repeat(2, 1fr); }
  .action-btn:nth-child(2) { border-right: 0; }
  .action-btn:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .footer-text-group, .modal-actions { flex-direction: column; align-items: stretch; }
  #footerText { white-space: normal; }
  .modal-card { padding: 20px; }
}


