/* 
  Fahim Photocard Generator - FINAL SUPREME SPLIT WORKSPACE
  SaaS Edition with User Management & Admin Control
*/

@font-face {
  font-family: 'ShurjoWeb';
  src: url('https://assets.prothomalo.com/prothomalo/assets/ShurjoWeb_400_v5_1.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --bg-dark: #0f172a;
  --bg-sidebar: #131c31;
  --card-bg: rgba(30, 41, 59, 0.4);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.05);
  --accent: #f43f5e;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.main-header {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo a {
  font-size: 1.5rem;
  font-weight: 900;
  color: #fff;
  text-decoration: none;
}

.logo span {
  color: var(--primary);
  font-weight: 300;
}

.nav-links {
  display: flex;
  gap: 25px;
  align-items: center;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: #fff;
}

.btn-primary {
  background: var(--primary);
  color: #fff !important;
  padding: 8px 18px;
  border-radius: 8px;
  transition: all 0.2s !important;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

/* Forms (Login/Register) */
.auth-container {
  max-width: 500px;
  margin: 60px auto;
  padding: 40px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-header h1 {
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.auth-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.form-group input, 
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #fff;
  outline: none;
  font-family: inherit;
}

.form-group input:focus {
  border-color: var(--primary);
}

.form-submit {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.2s;
}

.form-submit:hover {
  background: var(--primary-hover);
}

/* Dashboard Override */
.theme-dashboard {
  height: 100vh;
  overflow: hidden;
}

.theme-dashboard main {
  flex: 1;
  height: calc(100vh - 70px);
}

/* Admin Table */
.admin-container {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
}

.data-table-wrapper {
  overflow-x: auto;
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th, .data-table td {
  padding: 15px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pending { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.status-approved { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.status-disabled { background: rgba(239, 68, 68, 0.2); color: var(--danger); }

.action-links a {
  margin-right: 10px;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--primary);
}

/* Footer */
.main-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 40px 0;
  background: rgba(15, 23, 42, 0.5);
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 20px;
  margin-top: 15px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
}

/* Landing Page (Index) */
.hero {
  max-width: 900px;
  margin: 100px auto;
  text-align: center;
  padding: 0 20px;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 20px;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 40px;
}

/* Utility */
.alert {
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.alert-error { background: rgba(239, 68, 68, 0.2); color: #fecaca; border: 1px solid rgba(239, 68, 68, 0.3); }
.alert-success { background: rgba(16, 185, 129, 0.2); color: #d1fae5; border: 1px solid rgba(16, 185, 129, 0.3); }

/* --- ORIGINAL GENERATOR STYLES --- */
.app-container {
  display: flex;
  height: 100%;
}

.template-sidebar {
  width: 100px;
  background: #0a0f1d;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 15px 10px;
  overflow-y: auto;
  position: relative;
  z-index: 100;
}

.sidebar-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 800;
  margin-bottom: 20px;
  text-align: center;
}

.template-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 15px !important;
  width: 100% !important;
}

.template-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto !important;
  user-select: none;
}

.template-item span {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.template-item:hover .thumb {
  transform: translateY(-5px);
  border-color: var(--primary);
}

.template-item.active .thumb {
  border: 3px solid var(--primary);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}
.template-item.active span { color: #fff; }

.thumb {
  display: block !important;
  width: 65px !important;
  height: 81px !important;
  aspect-ratio: 1080 / 1350;
  border-radius: 6px;
  background: #334155;
  border: 1.5px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: inherit;
  margin: 0 auto !important;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.glass-thumb { background: linear-gradient(to bottom, #1e293b 60%, rgba(255,255,255,0.1) 61%, #000 100%); }
.glass-thumb::after { content:''; position:absolute; bottom:5px; left:5px; right:5px; height:2px; background:rgba(255,255,255,0.3); }

.split-thumb { background: #1e293b; }
.split-thumb::before { content:''; position:absolute; top:0; left:0; width:100%; height:45%; background:#444; }
.split-thumb::after { content:''; position:absolute; top:45%; left:0; width:100%; height:2px; background:#ffcc00; }

.poster-thumb { background: radial-gradient(circle, #333 0%, #000 100%); }
.poster-thumb::before { content:''; position:absolute; top:20%; left:20%; width:60%; height:2px; background:rgba(255,255,255,0.5); }

.minimal-thumb { border: 2px solid #555; background: #fff; }
.minimal-thumb::before { content:''; position:absolute; top:20%; left:20%; width:60%; height:30%; background:#eee; border:1px solid #ccc; }

.gradient-thumb { background: linear-gradient(135deg, #6366f1, #000, #ff3366); }

.neon-thumb { background: #000; border: 1.5px solid #00ffff; box-shadow: inset 0 0 10px #00ffff; }
.neon-thumb::before { content:''; position:absolute; bottom:10px; left:10px; width:40%; height:2px; background:#00ffff; }

.retro-thumb { background: #2c1e14; }
.retro-thumb::before { content:''; position:absolute; top:0; left:0; width:100%; height:5px; background:#000; }
.retro-thumb::after { content:''; position:absolute; bottom:0; left:0; width:100%; height:5px; background:#000; }

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 25px;
  background: radial-gradient(circle at top left, #1e293b, #0f172a);
  border-right: 1px solid var(--border);
  position: relative;
}

.stage-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.stage-header h1 {
  font-size: 1.3rem;
  font-weight: 900;
  color: #fff;
  white-space: nowrap;
}

.stage-header h1 span {
  font-weight: 300;
  color: var(--text-muted);
}

.url-input-area {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  width: 100%;
  gap: 5px;
}

.url-input-area input {
  background: transparent;
  border: none;
  color: #fff;
  padding: 6px 15px;
  flex: 1;
  font-size: 0.85rem;
  outline: none;
}

.action-btn {
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 15px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  white-space: nowrap;
}

.action-btn:hover { background: rgba(255, 255, 255, 0.15); transform: translateY(-1px); }

#fetchBtn { background: var(--primary); border: none; }
#fetchBtn:hover { background: #4f46e5; }

.action-btn.download { background: #10b981; border: none; }
.action-btn.download:hover { background: #059669; }

.action-btn.refresh { padding: 0 12px; }

.canvas-mount {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

canvas {
  height: 100%;
  max-height: 100%;
  aspect-ratio: 1080 / 1350;
  background: #000;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6);
  border-radius: 8px;
}

.controls {
  width: 650px;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 30px rgba(0,0,0,0.2);
}

.control-header {
  padding: 15px 20px;
  font-size: 0.85rem;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
}

.settings-grid {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: start;
}

/* --- Refined Editor UI (Screenshot Match) --- */
.card {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
  height: fit-content;
  transition: all 0.2s;
}

.card:hover { 
  background: rgba(30, 41, 59, 0.6);
  border-color: var(--primary);
}

.card-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.5px;
}

.card-title::before {
  content: '';
  width: 4px;
  height: 14px;
  background: var(--primary);
  border-radius: 2px;
}

.field label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 700;
}

.field input[type="text"],
.field input[type="url"],
.field select,
.field textarea {
  width: 100%;
  padding: 10px 14px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all 0.2s;
  appearance: none;
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  outline: none;
  background: #131c31;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

/* Color Picker Chips */
.color-field input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  width: 100%;
  height: 42px;
  background: none;
  cursor: pointer;
}

.color-field input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-field input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
}

/* Styled Range Inputs */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin: 10px 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

/* Custom Upload Box */
.upload-box {
  background: rgba(255,255,255,0.02);
  border: 1.5px dashed rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 10px;
}

.upload-box:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
  color: #fff;
}

.loader {
  position: absolute; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}

.loader.active { opacity: 1; }

.spinner { width: 30px; height: 30px; border: 3px solid rgba(255,255,255,0.1); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

.hidden { display: none !important; }

@media (max-width: 1100px) {
  .controls { width: 450px; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app-container { flex-direction: column; }
  .stage { height: 70vh; }
  .controls { width: 100%; border-left: none; height: auto; overflow: visible; }
  .settings-grid { grid-template-columns: 1fr 1fr; height: auto; overflow: visible; }
  .theme-dashboard main { height: auto; overflow: visible; }
  .template-sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .template-list { flex-direction: row; gap: 20px; }
  .sidebar-title { display: none; }
}
