@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ────────────────────────────────────────────────────────── */
:root {
  --bg-color:     #0b1121;
  --bg-gradient:  radial-gradient(circle at 50% 0%, #1e293b 0%, #0b1121 70%);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent:       #3b82f6;
  --accent-hover: #2563eb;
  --success:      #10b981;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --glass-bg:     rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }

body {
  background: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Glass card ──────────────────────────────────────────────────────────── */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  position: sticky; top: 0; z-index: 100;
  padding: 16px 5%;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(11, 17, 33, 0.8);
  backdrop-filter: blur(20px);
}
header h1 {
  font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(to right, #fff, #94a3b8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.trust-badge-header {
  font-size: 0.85rem; color: var(--success);
  display: flex; align-items: center; gap: 6px; font-weight: 500;
}

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 80px 20px 40px; }
.hero h2 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; margin-bottom: 12px; letter-spacing: -1px; }
.hero p  { color: var(--text-secondary); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; padding: 20px 0 60px; }

/* ── Product Card ────────────────────────────────────────────────────────── */
.card {
  padding: 24px; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-6px); box-shadow: 0 20px 40px rgba(0,0,0,0.4); border-color: rgba(255,255,255,0.15); }
.card::before {
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px;
  background: linear-gradient(90deg, var(--accent), #8b5cf6); opacity: 0; transition: opacity 0.3s;
}
.card:hover::before { opacity: 1; }

.badges { display: flex; gap: 8px; margin-bottom: 16px; }
.badge  { padding: 4px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; }
.badge.verified { background: rgba(16,185,129,0.15); color: #34d399; }

.card h3     { font-size: 1.35rem; font-weight: 700; margin-bottom: 6px; line-height: 1.3; }
.card .seller { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 16px; display: flex; align-items: center; gap: 6px; }
.card .desc  { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 24px; flex-grow: 1; line-height: 1.6; }
.card .price-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card .price { font-size: 1.8rem; font-weight: 800; color: #fff; }

/* ── Quantity control (new) ───────────────────────────────────────────────── */
.qty-control {
  display: flex; align-items: center; gap: 0;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: 10px; overflow: hidden;
}
.qty-btn {
  width: 34px; height: 34px; font-size: 1.1rem; font-weight: 700;
  background: transparent; color: var(--text-primary);
  border: none; cursor: pointer; padding: 0;
  display: flex; justify-content: center; align-items: center;
  transition: background 0.15s;
}
.qty-btn:hover { background: rgba(255,255,255,0.1); }
.qty-input {
  width: 38px; height: 34px; text-align: center;
  background: transparent; border: none; border-left: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
  color: white; font-weight: 700; font-size: 0.95rem;
  padding: 0; outline: none; -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ── Total display (new) ─────────────────────────────────────────────────── */
.total-display {
  font-size: 0.88rem; font-weight: 600;
  color: var(--accent); text-align: right;
  margin-bottom: 14px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
button {
  background: var(--accent); color: white; border: none;
  padding: 14px 24px; border-radius: 12px;
  font-weight: 600; font-size: 1rem; cursor: pointer;
  transition: all 0.2s; width: 100%;
  display: flex; justify-content: center; align-items: center; gap: 8px;
}
button:hover:not(:disabled)  { background: var(--accent-hover); transform: scale(1.02); }
button:active:not(:disabled) { transform: scale(0.98); }
button:disabled { opacity: 0.7; cursor: not-allowed; }

/* ── Skeleton ────────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.sk-title  { height: 28px; width: 80%; margin-bottom: 12px; }
.sk-text   { height: 16px; width: 100%; margin-bottom: 8px; }
.sk-text.short { width: 60%; margin-bottom: 24px; }
.sk-price  { height: 36px; width: 40%; margin-bottom: 20px; }
.sk-btn    { height: 48px; width: 100%; border-radius: 12px; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(8px);
  display: flex; justify-content: center; align-items: center;
  z-index: 1000; opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease; padding: 20px;
}
@media (max-width: 600px) { .modal-overlay { align-items: flex-end; padding: 0; } }
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal-content {
  width: 100%; max-width: 440px; padding: 32px; border-radius: 24px;
  transform: translateY(50px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative; background: #0f172a;
  border: 1px solid var(--glass-border);
  max-height: 92vh; overflow-y: auto;
}
@media (max-width: 600px) {
  .modal-content { border-radius: 24px 24px 0 0; transform: translateY(100%); padding: 32px 24px; }
}
.modal-overlay.active .modal-content { transform: translateY(0) scale(1); }

.close-modal {
  position: absolute; top: 16px; right: 16px;
  background: rgba(255,255,255,0.1); width: 36px; height: 36px;
  border-radius: 50%; font-size: 1.2rem; color: var(--text-secondary);
  padding: 0; display: flex; justify-content: center; align-items: center;
  transition: background 0.2s; width: 36px;
}
.close-modal:hover { background: rgba(255,255,255,0.2); color: white; }

.modal-header { text-align: center; margin-bottom: 24px; }
.modal-header h3 { font-size: 1.4rem; margin-bottom: 8px; }
.modal-price { font-size: 2rem; font-weight: 800; color: var(--accent); }

.payment-steps {
  background: rgba(0,0,0,0.2); border-radius: 16px; padding: 20px;
  border: 1px solid var(--glass-border); margin-bottom: 24px;
}
.step { margin-bottom: 20px; }
.step:last-child { margin-bottom: 0; }
.step-title {
  font-weight: 600; color: white; margin-bottom: 12px; font-size: 0.95rem;
  display: flex; align-items: center; gap: 8px;
}
.step-title span {
  background: var(--accent); color: white;
  width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; justify-content: center; align-items: center;
  font-size: 0.75rem; flex-shrink: 0;
}

/* ── UPI instruction block (new, replaces QR image) ──────────────────────── */
.upi-instruction {
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 12px; padding: 16px;
  font-size: 0.95rem; color: var(--text-secondary);
  text-align: center; line-height: 1.7;
  margin-bottom: 8px;
}
.upi-highlight {
  display: inline-block; margin-top: 6px;
  font-family: monospace; font-size: 1.1rem; font-weight: 700;
  color: var(--accent); letter-spacing: 0.5px;
  background: rgba(59,130,246,0.12);
  padding: 4px 12px; border-radius: 8px;
}
.upi-hint {
  font-size: 0.78rem; color: var(--text-secondary);
  text-align: center; margin-top: 4px;
}

/* ── Phone input inside modal ─────────────────────────────────────────────── */
#buyerPhone {
  margin-bottom: 4px;
  border-color: var(--glass-border);
}
#buyerPhone:focus { border-color: var(--accent); }

/* Legacy QR box kept for any existing products that have qrUrl */
.qr-box { background: white; padding: 12px; border-radius: 12px; display: inline-block; margin-bottom: 12px; }
.qr-box img { width: 180px; height: 180px; display: block; }
.upi-id { font-family: monospace; font-size: 0.9rem; color: var(--text-secondary); background: rgba(255,255,255,0.05); padding: 8px; border-radius: 8px; }

.urgency-text {
  text-align: center; font-size: 0.85rem; color: var(--success); margin-top: 16px;
  display: flex; justify-content: center; align-items: center; gap: 6px;
}

/* ── Admin Layout ─────────────────────────────────────────────────────────── */
.admin-container { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; padding: 30px 20px;
  border-right: 1px solid var(--glass-border);
  background: rgba(11, 17, 33, 0.5);
  position: relative;
}
.sidebar h2 {
  font-weight: 800;
  background: linear-gradient(to right, #fff, var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 14px; color: var(--text-secondary);
  text-decoration: none; border-radius: 12px;
  margin-bottom: 8px; transition: 0.2s; font-weight: 500;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  background: var(--accent); color: white;
  box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}
.main-content { flex-grow: 1; padding: 40px; max-width: calc(100vw - 260px); overflow-y: auto; }

/* ── Role tag (new) ──────────────────────────────────────────────────────── */
.role-tag {
  display: inline-block; padding: 4px 12px; border-radius: 99px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.3px;
}
.role-admin  { background: rgba(245,158,11,0.15); color: var(--warning); }
.role-seller { background: rgba(59,130,246,0.15); color: var(--accent); }

/* ── Forms & Tables ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; text-align: left; }
.form-group label { display: block; margin-bottom: 8px; font-size: 0.9rem; color: var(--text-secondary); font-weight: 500; }
input, textarea, select {
  width: 100%; padding: 14px;
  background: rgba(0,0,0,0.3); border: 1px solid var(--glass-border);
  border-radius: 12px; color: white; outline: none;
  transition: border 0.2s; font-size: 0.95rem;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}
input[readonly] { opacity: 0.6; cursor: not-allowed; }
select option { background: var(--bg-color); color: white; }

table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 10px; }
th, td { padding: 16px; text-align: left; border-bottom: 1px solid var(--glass-border); font-size: 0.95rem; }
th { color: var(--text-secondary); font-weight: 600; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 0.5px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

.status-badge { padding: 6px 12px; border-radius: 6px; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; }
.status-pending   { background: rgba(245,158,11,0.15); color: var(--warning); }
.status-completed { background: rgba(16,185,129,0.15); color: var(--success); }

.action-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-sm       { padding: 8px 12px; font-size: 0.85rem; width: auto; border-radius: 8px; }
.btn-danger   { background: var(--danger); }
.btn-danger:hover:not(:disabled)    { background: #dc2626; }
.btn-secondary { background: rgba(255,255,255,0.1); color: white; }
.btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.2); }

/* ── Login box ───────────────────────────────────────────────────────────── */
.login-box {
  max-width: 420px; width: 100%; margin: 10vh auto; padding: 48px 40px;
}
.login-box h2 { font-size: 1.8rem; font-weight: 800; margin-bottom: 32px; text-align: center; }

/* ── Utility ─────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
