:root {
  --bg-main: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-secondary: #e2e8f0;
  --border-color: #cbd5e1;
  --border-focus: #2563eb;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent-primary: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-danger: #dc2626;
  --accent-danger-hover: #b91c1c;
  --accent-success: #16a34a;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.12), 0 2px 6px -2px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.12), 0 4px 8px -4px rgba(0, 0, 0, 0.08);
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Clean Panel Containers */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Login container */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2.25rem;
}

.login-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text-main);
  text-align: center;
}

.login-card p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.75rem;
  text-align: center;
}

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

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

.input-field {
  width: 100%;
  padding: 0.65rem 0.875rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

a, a:hover, a:visited, a:active {
  text-decoration: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none !important;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary, a.btn-primary, a.btn-primary:visited {
  background-color: var(--accent-primary) !important;
  color: #ffffff !important;
  border-color: var(--accent-primary) !important;
  text-decoration: none !important;
}

.btn-primary:hover, a.btn-primary:hover {
  background-color: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
  color: #ffffff !important;
  text-decoration: none !important;
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
}

.btn-danger {
  background: var(--accent-danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: var(--accent-danger-hover);
}

.btn-success {
  background: var(--accent-success);
  color: #ffffff;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

/* Dashboard main layout */
.dashboard-content {
  max-width: 1280px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* Stats Row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: var(--radius-lg);
  transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-card-blue {
  background: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
}
.stat-card-blue .stat-value {
  color: #1d4ed8;
}
.stat-card-blue .stat-label {
  color: #3b82f6;
  font-weight: 600;
}

.stat-card-purple {
  background: #faf5ff !important;
  border: 1px solid #e9d5ff !important;
}
.stat-card-purple .stat-value {
  color: #7e22ce;
}
.stat-card-purple .stat-label {
  color: #a855f7;
  font-weight: 600;
}

.stat-card-green {
  background: #f0fdf4 !important;
  border: 1px solid #bbf7d0 !important;
}
.stat-card-green .stat-value {
  color: #15803d;
}
.stat-card-green .stat-label {
  color: #22c55e;
  font-weight: 600;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Toolbar & Filters */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.image-card {
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.image-card:hover {
  box-shadow: var(--shadow-md);
}

.card-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent-primary);
}

.img-wrapper {
  position: relative;
  width: 100%;
  height: 190px;
  background: var(--bg-secondary);
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
}

.img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

.image-card:hover .img-wrapper img {
  transform: scale(1.03);
}

.card-details {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-grow: 1;
}

.card-filename {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-secondary);
  color: var(--accent-primary);
  border: 1px solid var(--border-color);
  width: fit-content;
}

.card-meta {
  font-size: 0.775rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  margin-top: 0.2rem;
}

.card-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
}

.card-actions .btn {
  flex: 1;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

/* Category Pill List */
.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.cat-pill {
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cat-pill .count {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.05rem 0.4rem;
  border-radius: 10px;
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Modal Overlay for Progress & Full View */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  padding: 1.75rem;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
  margin: 1rem 0;
}

.progress-bar {
  height: 100%;
  background: var(--accent-primary);
  width: 0%;
  transition: width 0.15s ease;
}
