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

:root {
  --primary:   #4f46e5;
  --primary-h: #3730a3;
  --accent:    #7c3aed;
  --danger:    #dc2626;
  --success:   #16a34a;
  --bg:        #f1f5f9;
  --card:      #ffffff;
  --text:      #1e293b;
  --muted:     #64748b;
  --border:    #e2e8f0;
  --radius:    10px;
  --shadow:    0 4px 20px rgba(0,0,0,.08);
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ==================== NAVBAR ==================== */
.navbar {
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(79,70,229,.4);
}
.navbar .brand { font-size: 1.2rem; font-weight: 700; color: #fff; }
.navbar nav a {
  color: #e0e7ff;
  margin-left: 1.2rem;
  font-size: .95rem;
  transition: color .2s;
}
.navbar nav a:hover { color: #fff; text-decoration: none; }
.navbar .btn-logout {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  padding: .35rem .9rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: .9rem;
  margin-left: 1rem;
  transition: background .2s;
}
.navbar .btn-logout:hover { background: rgba(255,255,255,.3); }

/* ==================== MAIN CONTAINER ==================== */
.container { max-width: 1100px; margin: 2rem auto; padding: 0 1rem; }
.container-sm { max-width: 480px; margin: 3rem auto; padding: 0 1rem; }

/* ==================== CARDS ==================== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}
.card h2 { font-size: 1.3rem; margin-bottom: 1.2rem; color: var(--text); }

/* ==================== FORMS ==================== */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: .35rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: .97rem;
  color: var(--text);
  background: #f8fafc;
  transition: border-color .2s, box-shadow .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.15);
  background: #fff;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-block;
  padding: .55rem 1.4rem;
  border-radius: 7px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .2s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); text-decoration: none; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .88; }
.btn-success  { background: var(--success); color: #fff; }
.btn-outline  { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; text-decoration: none; }
.btn-sm { padding: .3rem .85rem; font-size: .85rem; }
.btn-full { width: 100%; }

/* ==================== TABLES ==================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f8fafc; font-weight: 700; color: var(--muted); text-transform: uppercase; font-size: .8rem; letter-spacing: .04em; }
tr:hover td { background: #f1f5f9; }

/* ==================== ALERTS ==================== */
.alert {
  padding: .75rem 1rem;
  border-radius: 7px;
  margin-bottom: 1rem;
  font-size: .93rem;
  font-weight: 500;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.alert-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }

/* ==================== BADGES ==================== */
.badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-blue    { background: #dbeafe; color: #1d4ed8; }
.badge-green   { background: #dcfce7; color: #15803d; }
.badge-yellow  { background: #fef9c3; color: #854d0e; }
.badge-red     { background: #fee2e2; color: #b91c1c; }

/* ==================== GRID ==================== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .navbar .brand { font-size: 1rem; }
}

/* ==================== PRODUCT CARD ==================== */
.product-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.product-card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(0,0,0,.12); }
.product-card img { width: 100%; height: 170px; object-fit: cover; background: #e2e8f0; }
.product-card .pc-body { padding: 1rem; }
.product-card .pc-name { font-weight: 700; font-size: 1.02rem; margin-bottom: .25rem; }
.product-card .pc-price { color: var(--primary); font-weight: 700; font-size: 1.05rem; }
.product-card .pc-actions { display: flex; gap: .5rem; margin-top: .75rem; }

/* ==================== VENDOR CARD ==================== */
.vendor-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem;
  text-align: center;
  transition: transform .2s;
}
.vendor-card:hover { transform: translateY(-3px); }
.vendor-card .vc-name { font-weight: 700; font-size: 1.05rem; margin-bottom: .3rem; }
.vendor-card .vc-cat  { color: var(--muted); font-size: .88rem; margin-bottom: .5rem; }

/* ==================== LOGIN PAGE ==================== */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
}
.login-box {
  background: #fff;
  border-radius: 14px;
  padding: 2.4rem 2.2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.login-box h1 { text-align: center; font-size: 1.4rem; margin-bottom: .2rem; color: var(--primary); }
.login-box .subtitle { text-align: center; color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }
.login-box .role-badge {
  text-align: center;
  margin-bottom: 1rem;
  padding: .35rem 1rem;
  border-radius: 99px;
  background: #ede9fe;
  color: var(--accent);
  font-weight: 700;
  font-size: .85rem;
  display: inline-block;
  width: 100%;
}

/* ==================== INDEX PAGE ==================== */
.index-hero {
  min-height: 100vh;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-align: center;
  padding: 2rem;
}
.index-hero h1 { font-size: 2.5rem; margin-bottom: .5rem; }
.index-hero p  { font-size: 1.1rem; opacity: .85; margin-bottom: 2.5rem; }
.role-cards { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.role-card {
  background: rgba(255,255,255,.12);
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 14px;
  padding: 2rem 2.5rem;
  min-width: 200px;
  cursor: pointer;
  transition: background .2s, transform .2s;
  text-decoration: none;
  color: #fff;
}
.role-card:hover { background: rgba(255,255,255,.22); transform: translateY(-4px); text-decoration: none; }
.role-card .icon { font-size: 2.5rem; display: block; margin-bottom: .7rem; }
.role-card span  { font-size: 1.15rem; font-weight: 700; }

/* ==================== SUCCESS PAGE ==================== */
.success-box {
  text-align: center;
  padding: 3rem 2rem;
}
.success-box .check { font-size: 4rem; color: var(--success); margin-bottom: 1rem; }
.success-box h2 { font-size: 1.8rem; margin-bottom: .5rem; }
.success-box p  { color: var(--muted); margin-bottom: 1.5rem; }

/* ==================== POPUP ==================== */
.popup-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.popup-overlay.active { display: flex; }
.popup-box {
  background: #fff;
  border-radius: 14px;
  padding: 2.4rem 2rem;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.popup-box h2 { font-size: 1.6rem; color: var(--success); margin-bottom: 1rem; }

/* ==================== MISC ==================== */
.flex-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.flex-gap { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--muted); font-size: .9rem; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.img-placeholder {
  width: 100%;
  height: 170px;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: .9rem;
}
