* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f5f7;
  color: #1f2933;
}

:root {
  color-scheme: light;
  --brand: #0b7285;
  --brand-dark: #075b6a;
  --border: #d0d7de;
  --background-card: #ffffff;
  --background-toolbar: rgba(255, 255, 255, 0.9);
  --danger: #c92a2a;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  --transition: 0.18s ease;
}

.hidden {
  display: none !important;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
  padding-bottom: 80px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.brand-title {
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: 0.01em;
}

.brand-subtitle {
  font-size: 0.9rem;
  color: #5f6c7b;
}

.session-controls {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--background-toolbar);
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}

.filters,
.actions {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.input-group.column {
  width: 100%;
}

.input-label {
  color: #52606d;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

input,
select,
textarea {
  padding: 0.5rem 0.75rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  background: #ffffff;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 114, 133, 0.16);
}

button {
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.2rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  background: var(--brand);
  color: #ffffff;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(11, 114, 133, 0.24);
}

button.secondary {
  background: #e9eef2;
  color: #1f2933;
  box-shadow: none;
}

button.secondary:hover {
  background: #dce4ea;
  box-shadow: none;
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  box-shadow: 0 6px 16px rgba(201, 42, 42, 0.24);
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  gap: 1rem;
  font-size: 0.95rem;
  color: #3e4c59;
}

#messages {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.message {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  background: #dceefc;
  color: #0b7285;
}

.message.error {
  background: #ffe3e3;
  color: #c92a2a;
}

.message.success {
  background: #d3f9d8;
  color: #2b8a3e;
}

.loading {
  padding: 4rem 0;
  text-align: center;
  color: #52606d;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 1.5rem;
}

.image-card {
  display: flex;
  flex-direction: column;
  background: var(--background-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.image-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.18);
}

.image-card.assigned {
  border-color: rgba(11, 114, 133, 0.75);
}

.image-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #f5f7fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
}

.image-frame .placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  color: #5f6c7b;
  font-size: 0.9rem;
  background: rgba(244, 245, 247, 0.95);
  opacity: 0;
  transition: opacity var(--transition);
}

.image-card.no-preview .placeholder {
  opacity: 1;
}

.image-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
}

.image-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: #5f6c7b;
}

.image-name {
  font-weight: 600;
  color: #1f2933;
}

.assignment {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.assigned-product {
  font-size: 0.85rem;
  color: #0b7285;
  min-height: 1rem;
}

.assignment-actions {
  display: flex;
  gap: 0.5rem;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

.floating-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  z-index: 20;
  box-shadow: var(--shadow);
}

.active-product-panel {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 2rem 1.5rem;
  z-index: 25;
}

.active-product-panel .panel-content {
  background: #ffffff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  width: min(480px, 100%);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.active-product-summary {
  background: #f1f5f9;
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 0.95rem;
}

@media (max-width: 1024px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    position: static;
  }

  .session-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .actions {
    width: 100%;
    justify-content: flex-start;
  }

  .filters {
    width: 100%;
  }

  .floating-button {
    bottom: 16px;
    right: 16px;
  }
}

@media (max-width: 768px) {
  .filters,
  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .image-grid {
    grid-template-columns: 1fr;
  }
}
