/* Creative Factory page styles - matches Coca-Cola Intelligence Theme */

/* General content padding */
.content-area {
  padding: 24px 28px;
}

/* Stats Card Row */
.factory-stats-card {
  display: flex;
  align-items: center;
  gap: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 24px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}

.factory-stat-group {
  display: flex;
  gap: 32px;
}

.factory-stat {
  display: flex;
  flex-direction: column;
}

.factory-stat-value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
}

#factoryTotal {
  color: var(--red);
}

#factoryGenerated,
#factoryRemaining {
  color: var(--text-1);
}

.factory-stat-label {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.factory-progress-wrapper {
  flex: 1;
  min-width: 200px;
}

.factory-progress-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}

.factory-progress-bar-fill {
  width: 100%;
  height: 100%;
  background: var(--red);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* Base Template Strip */
.factory-template-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.75));
  color: #fff;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
  gap: 16px;
}

.base-left {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.template-badge {
  background: rgba(255, 255, 255, 0.06);
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.06em;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.template-thumb {
  width: 48px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.template-info strong {
  font-size: 15px;
  display: block;
  margin-bottom: 2px;
}

.template-info div {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
}

/* Buttons and Actions */
.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-1);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.btn-outline:hover {
  background: var(--surface-2);
  border-color: var(--text-3);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  border: none;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(230, 27, 35, 0.15);
  transition: all 0.2s var(--ease);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(230, 27, 35, 0.22);
}

.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.btn-upload:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.35);
}

/* Conveyor Section */
.conveyor-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
}

.conveyor-fade-left {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 60px;
  background: linear-gradient(90deg, var(--bg-main) 0%, transparent 100%);
  z-index: 10;
  pointer-events: none;
}

.conveyor-fade-right {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 60px;
  background: linear-gradient(270deg, var(--bg-main) 0%, transparent 100%);
  z-index: 10;
  pointer-events: none;
}

.conveyor-track {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 8px 0;
}

.conveyor-row {
  width: 100%;
  overflow: hidden;
}

.conveyor-belt {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 6px 12px;
  will-change: transform;
}

/* Creative Card */
.creative-card {
  height: auto;
  width: 260px;
  min-width: 260px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.creative-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.creative-thumb {
  width: 100%;
  aspect-ratio: 9 / 14;
  /* Default portrait but can adapt */
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-color: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.creative-meta {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}

.creative-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}

.creative-title {
  font-weight: 800;
  font-size: 12.5px;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

.creative-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.creative-pct {
  color: var(--red);
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
}

/* Layout override to prevent flexbox content from stretching the page width */
.main-wrap {
  min-width: 0;
}

/* Allow page to scroll naturally */
html,
body {
  min-height: 100vh;
  overflow-y: auto;
}

.main-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content-area {
  flex: 1;
  padding: 16px 20px;
}

/* Custom styles for grid layout */
.creatives-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.all-creative-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.all-creative-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
  border-color: var(--primary);
}

.card-image-wrap {
  position: relative;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  width: 100%;
}

.card-img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.5s ease;
}

.all-creative-card:hover .card-img {
  transform: scale(1.03);
}

.not-generated-placeholder {
  width: 100%;
  height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #18181b 0%, #09090b 100%);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.placeholder-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.badge-not-generated {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 8px;
}

.badge-generated {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(16, 185, 129, 0.9);
  color: #fff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.card-info {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.store-name-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.store-region-sub {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.change-indicator {
  font-weight: 600;
  font-size: 12px;
}

.change-indicator.negative {
  color: var(--red);
}

.change-indicator.positive {
  color: #10b981;
}

.btn-goto-factory {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  color: var(--text-2);
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: color 0.2s var(--ease);
  text-decoration: none;
}

.btn-goto-factory:hover {
  transform: none;
  box-shadow: none;
  filter: none;
  color: var(--red);
}


/* Animations */
@keyframes pulseGlow {
  0% {
    transform: scale(0.95);
    opacity: 0.5;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  }

  70% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }

  100% {
    transform: scale(0.95);
    opacity: 0.5;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Responsive Rules */
@media (max-width: 768px) {
  .view-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }

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

  .factory-stats-card {
    flex-direction: column;
    align-items: stretch !important;
    gap: 16px !important;
    padding: 16px !important;
  }

  .factory-stat-group {
    justify-content: space-between;
    width: 100%;
  }

  .factory-progress-wrapper {
    width: 100%;
  }

  .factory-template-strip {
    flex-direction: column;
    align-items: stretch !important;
    padding: 16px !important;
  }

  .base-left {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .template-thumb {
    width: 100% !important;
    height: 180px !important;
  }

  .template-upload-area {
    width: 100%;
    margin-top: 8px;
  }

  .btn-upload {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .factory-stat-group {
    flex-direction: column;
    gap: 12px !important;
  }

  .factory-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
  }

  .factory-stat:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .factory-stat-value {
    font-size: 18px !important;
  }

  .factory-stat-label {
    margin-top: 0 !important;
  }
}

@media (max-width: 600px) {
  .creative-actions {
    flex-direction: column;
    align-items: stretch !important;
    width: 100%;
  }
  .creative-actions > *,
  .creative-actions button {
    width: 100%;
    justify-content: center;
  }
}
