/* ========================================
   Pinterest Bulk Upload – Design System
   ======================================== */

:root {
  /* Color palette */
  --bg-app: #070914;
  --bg-panel: #131832;
  --bg-card: #181f3f;
  --bg-input: #0f142b;
  --border: #2e3862;
  --border-focus: #e6003a;
  --accent: #ff2f62;
  --accent-hover: #ff4f79;
  --accent-soft: rgba(255,47,98,0.16);
  --text: #f2f4ff;
  --text-muted: #98a3ce;
  --text-faint: #6c7599;
  --green: #00c97b;
  --yellow: #f5c542;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 20px 46px rgba(0,0,0,0.38);
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Sora', 'Manrope', sans-serif;

  /* Glassmorphism */
  --glass-bg: rgba(18, 24, 51, 0.72);
  --glass-blur: 22px;
}

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

body {
  font-family: var(--font);
  background:
    radial-gradient(900px 480px at 0% -8%, rgba(255, 72, 120, 0.16), transparent 62%),
    radial-gradient(760px 420px at 100% 0%, rgba(72, 112, 255, 0.18), transparent 66%),
    linear-gradient(180deg, #080b17 0%, #04060d 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  position: relative;
  overflow-x: hidden;
}
body::before,
body::after {
  content: "";
  position: fixed;
  width: 380px;
  height: 380px;
  filter: blur(100px);
  z-index: -1;
  opacity: 0.45;
}
body::before {
  top: -180px;
  left: -150px;
  background: rgba(255, 60, 112, 0.55);
}
body::after {
  top: 24%;
  right: -180px;
  background: rgba(74, 110, 255, 0.45);
}

/* -------- Shell -------- */
.app-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 26px 30px 48px;
  animation: app-fade-in 420ms ease-out;
}
@keyframes app-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* -------- Header -------- */
.app-header {
  text-align: center;
  margin-bottom: 36px;
}
.header-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.brand-icon {
  font-size: 32px;
  animation: pin-bounce 2.2s ease-in-out infinite;
}
@keyframes pin-bounce {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-6px); }
}
.app-header h1 {
  font-family: var(--font-heading);
  font-size: 31px;
  font-weight: 800;
  letter-spacing: 0.2px;
  background: linear-gradient(135deg, var(--accent) 30%, #ff6b8a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header-sub {
  color: var(--text-muted);
  font-size: 15px;
  margin-top: 8px;
}

/* -------- Layout -------- */
.app-main {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 26px;
  align-items: start;
}
@media (max-width: 960px) {
  .app-main {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .actions,
  .download-bar {
    flex-direction: column;
  }
}

/* -------- Panels -------- */
.panel {
  background:
    linear-gradient(155deg, rgba(255,255,255,0.06), rgba(255,255,255,0.01) 42%),
    var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid rgba(118, 130, 187, 0.28);
  border-radius: var(--radius);
  padding: 24px 22px;
  box-shadow: var(--shadow);
}
.panel-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--text);
  letter-spacing: 0.25px;
}
.panel-copy {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 18px;
}
.section-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin: 18px 0 10px;
}

/* -------- Tabs -------- */
.tab-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  padding: 10px;
  background:
    linear-gradient(160deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01)),
    rgba(10, 14, 31, 0.72);
  border: 1px solid rgba(126, 139, 191, 0.28);
  border-radius: calc(var(--radius) + 4px);
}
.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 86px;
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 16px;
  padding: 15px 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0)),
    var(--bg-input);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.15s, box-shadow 0.2s;
}
.tab-btn:hover {
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 9px 24px rgba(0,0,0,0.24);
  transform: translateY(-1px);
}
.tab-btn.active {
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.16), rgba(255,255,255,0) 42%),
    linear-gradient(135deg, var(--accent), #ff5e85);
  border-color: rgba(255,255,255,0.18);
  color: #fff;
  box-shadow: 0 14px 32px rgba(255,47,98,0.34);
}
.tab-btn-title {
  display: block;
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.tab-btn-copy {
  display: block;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
  max-width: none;
}
.tab-btn.active .tab-btn-copy {
  color: rgba(255,255,255,0.82);
}
.workflow-panel[hidden] {
  display: none !important;
}
.workflow-panel.active {
  animation: panel-fade 260ms ease-out;
}
@keyframes panel-fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.history-note {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 201, 123, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(0, 201, 123, 0.08);
  color: #b8f1d8;
  font-size: 12px;
  line-height: 1.5;
}

/* -------- Fields -------- */
.field-group {
  margin-bottom: 14px;
}
.field-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

input[type="text"],
input[type="number"],
input[type="datetime-local"],
select {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
select {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239090a8' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}
input[type="checkbox"] {
  accent-color: var(--accent);
  margin-right: 6px;
  transform: scale(1.1);
}

/* -------- File Drops -------- */
.file-drop {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 14px;
  min-height: 94px;
  display: grid;
  place-content: center;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0)),
    var(--bg-input);
}
.file-drop:hover,
.file-drop.drag-over {
  border-color: rgba(255, 115, 151, 0.7);
  background: rgba(255,47,98,0.12);
}
.file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.drop-label {
  font-size: 13px;
  color: var(--text-muted);
}
.drop-label em {
  color: var(--accent);
  font-style: normal;
  text-decoration: underline;
}
.file-name {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--green);
  font-weight: 500;
  word-break: break-all;
}
.file-name:empty { display: none; }

/* -------- cPanel details -------- */
.cpanel-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 8px;
  margin-bottom: 14px;
}
.cpanel-section summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  outline: none;
}
.cpanel-section[open] summary {
  margin-bottom: 12px;
  color: var(--text);
}

/* -------- Buttons -------- */
.actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.btn {
  padding: 12px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
  letter-spacing: 0.3px;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  flex: 1;
  background: linear-gradient(135deg, #ff2f62, #ff6f95);
  color: #fff;
  box-shadow: 0 8px 18px rgba(255,47,98,0.35);
}
.btn-primary:hover {
  box-shadow: 0 10px 28px rgba(255,47,98,0.45);
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-secondary {
  background: rgba(20, 27, 56, 0.86);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--text-muted); }

/* -------- Stats Bar -------- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: rgba(19, 27, 56, 0.88);
  border: 1px solid rgba(123, 136, 191, 0.25);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.stat-value {
  display: block;
  font-size: 30px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* -------- Table -------- */
.table-wrap {
  overflow-x: auto;
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid rgba(123, 136, 191, 0.28);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  background: rgba(14, 20, 42, 0.75);
}
#preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
#preview-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
#preview-table th {
  background: rgba(20, 28, 58, 0.96);
  color: var(--text-muted);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
}
#preview-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(67,78,123,0.35);
  color: var(--text);
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
#preview-table tbody tr {
  transition: background 0.15s;
}
#preview-table tbody tr:hover {
  background: rgba(255,47,98,0.09);
}
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-faint);
  font-size: 13px;
}
#preview-table ~ .empty-state { display: none; }
.show-empty #preview-table { display: none; }
.show-empty .empty-state { display: block !important; }

/* -------- Download Bar -------- */
.download-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.btn-download {
  flex: 1;
  min-width: 220px;
  background: linear-gradient(135deg, #00b86b, #00d78c);
  color: #fff;
  box-shadow: 0 6px 16px rgba(0,201,123,0.28);
}
.btn-download:hover {
  box-shadow: 0 5px 20px rgba(0,201,123,0.45);
}

/* -------- Log Box -------- */
.log-box {
  background: rgba(11, 16, 36, 0.88);
  border: 1px solid rgba(123, 136, 191, 0.24);
  border-radius: var(--radius-sm);
  padding: 14px;
}
#log-output {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  line-height: 1.65;
  color: #aab3d8;
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* -------- Progress -------- */
.progress-bar-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 16px;
  display: none;
}
.progress-bar-wrap.active { display: block; }
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #ff6b8a);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 2px;
}

/* -------- Scrollbar -------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

@media (max-width: 960px) {
  .app-shell {
    padding: 12px 12px 24px;
  }
  .panel {
    padding: 16px 14px;
    border-radius: 14px;
  }
  .app-header h1 {
    font-size: 24px;
  }
  .header-sub {
    font-size: 13px;
  }
  .panel-title {
    font-size: 18px;
  }
  .tab-btn {
    min-height: 72px;
    padding: 12px;
  }
  .tab-btn-title {
    font-size: 15px;
  }
  .tab-btn-copy {
    font-size: 11px;
  }
}
