/* Buttons, cards, forms, nav - AImart-style */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--min-touch);
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.btn:focus { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.btn:focus:not(:focus-visible) { outline: none; }
.btn-primary {
  background: var(--color-primary-gradient);
  color: #fff;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
}
.btn-secondary {
  background: #f1f5f9;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}
.btn-block { width: 100%; }
a.btn { text-decoration: none; }
a.btn:hover { text-decoration: none; }

.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  border: 1px solid var(--color-border);
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

/* Cards in main content use full width of container */
#main .card {
  width: 100%;
  max-width: 100%;
}

.form-group { margin-bottom: var(--space-md); }
.form-label { display: block; margin-bottom: var(--space-xs); font-weight: 500; color: var(--color-text); font-size: 0.875rem; }
.form-control {
  width: 100%;
  min-height: var(--min-touch);
  padding: 0.625rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}
textarea.form-control { min-height: 100px; resize: vertical; padding: 0.75rem 1rem; }
.form-error { color: var(--color-error); font-size: 0.875rem; margin-top: var(--space-xs); }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 var(--space-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.nav-brand {
  font-weight: 700;
  font-size: 1.375rem;
  background: var(--color-primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}
.nav-brand:hover { text-decoration: none; -webkit-text-fill-color: var(--color-primary); }
.nav-links { display: flex; align-items: center; gap: var(--space-sm); list-style: none; margin: 0; padding: 0; }
.nav-links a {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition);
}
.nav-links a:hover { background: #f1f5f9; color: var(--color-primary); text-decoration: none; }

.alert { padding: var(--space-md); border-radius: var(--radius); margin-bottom: var(--space-md); }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

.loading { text-align: center; padding: var(--space-xl); color: var(--color-text-muted); font-weight: 500; }

@media (max-width: 768px) {
  .nav { padding: 0 var(--space-md); min-height: 56px; }
  .nav-links { flex-wrap: wrap; }
}

/* Modern upload zones: image preview + document preview */
.upload-zone {
  position: relative;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--color-primary);
  background: rgba(5, 150, 105, 0.04);
}
.upload-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  pointer-events: none;
}
.upload-placeholder i {
  font-size: 2rem;
  color: var(--color-primary);
  opacity: 0.8;
}
.upload-preview {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  background: var(--color-bg);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  min-width: 0;
}
.upload-preview-image {
  padding: 0.25rem;
}
.upload-thumb {
  max-width: 140px;
  max-height: 100px;
  width: auto;
  height: auto;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}
.upload-preview-file {
  flex-wrap: wrap;
}
.upload-file-icon {
  font-size: 1.75rem;
  color: #dc2626;
  flex-shrink: 0;
}
.upload-file-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}
.upload-preview-clear {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: background 0.2s;
}
.upload-preview-clear:hover {
  background: #b91c1c;
}
.upload-zone:not(.has-preview) .upload-placeholder { display: flex; }
.upload-zone.has-preview .upload-placeholder { display: none; }
.upload-zone:not(.has-preview) .upload-preview { display: none !important; }
.upload-zone.has-preview .upload-preview { display: flex !important; }

.upload-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.upload-row .form-group-half { margin-bottom: 0; }
.upload-preview-multi { flex-wrap: wrap; }
.upload-thumbs { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.upload-thumbs .upload-thumb { max-width: 80px; max-height: 60px; object-fit: cover; border-radius: var(--radius-sm); }
.upload-files-list { display: flex; flex-wrap: wrap; flex-direction: column; gap: 0.25rem; }
.upload-files-list .upload-file-name { display: block; font-size: 0.8125rem; }
@media (max-width: 640px) {
  .upload-row { grid-template-columns: 1fr; }
}
