/* ============================================================
   INSTAGRAM PIN MAKER PRO — style.css v1.0.0
   Instagram-inspired dark theme with canvas editor
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@600;800&display=swap');

/* ============================================================
   ROOT / TOKENS
   ============================================================ */
:root {
  --ig-pink:    #e1306c;
  --ig-orange:  #f77737;
  --ig-purple:  #833ab4;
  --ig-gradient: linear-gradient(135deg, #833ab4, #e1306c, #f77737);
  --bg-dark:    #050508;
  --bg-card:    rgba(255,255,255,0.04);
  --border:     rgba(255,255,255,0.07);
  --accent:     #e1306c;
  --accent-cyan: #00d2ff;
  --text:       #f1f5f9;
  --text-dim:   #64748b;
  --text-muted: #94a3b8;
}

/* ============================================================
   WRAPPER
   ============================================================ */
.ipm-wrapper {
  font-family: 'Inter', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  padding: 0 0 40px;
}

/* ============================================================
   HEADER
   ============================================================ */
.ipm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  background: rgba(0,0,0,0.5);
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.ipm-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 800;
  background: var(--ig-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ipm-logo-icon { font-size: 24px; -webkit-text-fill-color: initial; }
.ipm-header-actions { display: flex; gap: 10px; align-items: center; }

/* ============================================================
   BUTTONS
   ============================================================ */
.ipm-btn {
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ipm-btn-primary {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}
.ipm-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(99,102,241,0.4); }

.ipm-btn-ig {
  background: var(--ig-gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(225,48,108,0.3);
}
.ipm-btn-ig:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(225,48,108,0.4); }

.ipm-btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.ipm-btn-ghost:hover { background: rgba(255,255,255,0.1); color: var(--text); }

/* ============================================================
   STEP CARD
   ============================================================ */
.ipm-step-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 24px;
  margin: 0 20px 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.ipm-step-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.ipm-step-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  font-family: 'Outfit', sans-serif;
}

.ipm-step-sub {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
}

/* ============================================================
   NAV BAR
   ============================================================ */
.ipm-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #12121a;
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  margin: 0 20px 20px;
  flex-wrap: wrap;
  gap: 10px;
}

/* ============================================================
   STUDIO GRID (3-col)
   ============================================================ */
.ipm-studio-grid {
  display: grid;
  grid-template-columns: 340px 1fr 320px;
  gap: 20px;
  padding: 0 20px;
  align-items: start;
}

@media (max-width: 1200px) {
  .ipm-studio-grid { grid-template-columns: 300px 1fr 280px; }
}
@media (max-width: 900px) {
  .ipm-studio-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.ipm-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ============================================================
   CARD
   ============================================================ */
.ipm-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.ipm-card-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
}

/* ============================================================
   FORM FIELDS
   ============================================================ */
.ipm-field { margin-bottom: 12px; }
.ipm-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.ipm-wrapper input[type="text"],
.ipm-wrapper input[type="url"],
.ipm-wrapper input[type="number"],
.ipm-wrapper textarea {
  width: 100%;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
  margin-bottom: 0;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.ipm-wrapper input:focus,
.ipm-wrapper textarea:focus { border-color: var(--accent); }

.ipm-select {
  width: 100%;
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  outline: none;
  cursor: pointer;
}
.ipm-select option { background: #1a1a2e; }

/* ============================================================
   SOURCE TABS
   ============================================================ */
.ipm-source-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 4px;
}

.ipm-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 7px 4px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}
.ipm-tab.active {
  background: var(--ig-gradient);
  color: #fff;
  box-shadow: 0 2px 6px rgba(225,48,108,0.4);
}

.ipm-tab-panel { display: block; }

/* ============================================================
   IMAGE THUMBNAILS (in source tabs)
   ============================================================ */
.ipm-img-thumb {
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
  position: relative;
}
.ipm-img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ipm-img-thumb:hover { border-color: var(--accent); transform: scale(1.04); }
.ipm-img-thumb.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(225,48,108,0.4); }

/* ============================================================
   DROP ZONE
   ============================================================ */
#ipm-drop-zone.drag-over {
  border-color: var(--accent) !important;
  background: rgba(225,48,108,0.08) !important;
}

/* ============================================================
   CANVAS AREA
   ============================================================ */
.ipm-canvas-area {
  display: flex;
  justify-content: center;
}

.ipm-canvas-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 520px;
}

.ipm-canvas-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-align: center;
  background: rgba(225,48,108,0.15);
  border: 1px solid rgba(225,48,108,0.3);
  padding: 6px 16px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.ipm-canvas-frame {
  width: 100%;
  background: #111;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04);
  position: relative;
  border: 3px solid #ef4444; /* Bright red border to clearly show the editor boundaries */
}

.ipm-canvas-frame canvas {
  width: 100%;
  height: auto;
  display: block;
}

/* ============================================================
   CSV TABLE (in white card)
   ============================================================ */
#ipm-csv-section { color: #0f172a; }
#ipm-csv-section .ipm-step-title { color: #0f172a; }

#ipm-csv-table tbody tr:hover { background: #f8fafc; }
#ipm-csv-table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; color: #334155; }
#ipm-csv-table input { background: #f8fafc; border: 1px solid #e2e8f0; color: #0f172a; border-radius: 6px; padding: 5px 8px; font-size: 12px; width: 100%; margin: 0; }

.ipm-csv-thumb {
  width: 90px;
  height: 135px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  margin: 0 auto;
}

.ipm-btn-del {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
}

/* ============================================================
   POSTS TABLE (in white step card)
   ============================================================ */
#ipm-posts-list tr:hover { background: #fafafa; }
#ipm-posts-list td { padding: 10px 16px; border-bottom: 1px solid #f1f5f9; color: #334155; vertical-align: middle; }
#ipm-posts-list .post-thumb { width: 48px; height: 60px; object-fit: cover; border-radius: 4px; display: block; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
::-webkit-scrollbar-thumb { background: rgba(225,48,108,0.4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(225,48,108,0.7); }

/* ============================================================
   SPINNER
   ============================================================ */
.ipm-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ipm-spin 0.7s linear infinite;
}
@keyframes ipm-spin { to { transform: rotate(360deg); } }

/* ============================================================
   NOTIFICATION TOAST
   ============================================================ */
.ipm-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  border-left: 4px solid var(--accent);
  z-index: 9999;
  animation: ipm-toast-in 0.3s ease;
  max-width: 320px;
}
.ipm-toast.success { border-left-color: #22c55e; }
.ipm-toast.error   { border-left-color: #ef4444; }
@keyframes ipm-toast-in { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform: translateY(0); } }

/* ============================================================
   AI PROGRESS
   ============================================================ */
.ipm-ai-progress {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(225,48,108,0.3);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 10px;
  display: none;
}
.ipm-ai-bar {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}
.ipm-ai-bar-fill {
  height: 100%;
  background: var(--ig-gradient);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}
.ipm-ai-status { font-size: 12px; color: #94a3b8; text-align: center; }

/* ============================================================
   INPUT NUMBER — hide spinners
   ============================================================ */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
