/* ═══════════════════════════════════════════
   IngenicMart Overseas Portal
   Modern, minimal, customer-facing
   ═══════════════════════════════════════════ */

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #0f172a;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-soft: #eef2ff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.1);
  --transition: 0.15s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--primary); text-decoration: none; }

.hidden { display: none !important; }

/* ─── Toast ─── */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  padding: 12px 24px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
}
.toast.visible { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* ─── Buttons ─── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 24px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  transition: background var(--transition), transform var(--transition);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 24px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  transition: border-color var(--transition), color var(--transition);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-sm { height: 36px; padding: 0 16px; font-size: 13px; }

.btn-link {
  color: var(--text-secondary);
  font-size: 13px;
  transition: color var(--transition);
}
.btn-link:hover { color: var(--primary); }

.btn-code { height: 40px; padding: 0 16px; font-size: 13px; white-space: nowrap; margin-top: 24px; }

.full-btn { width: 100%; }

/* ─── Form Fields ─── */
label {
  display: block;
}
label span {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
label input, label textarea, label select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
label textarea { height: 100px; padding: 12px 14px; resize: vertical; }
label input:focus, label textarea:focus, label select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
label input::placeholder, label textarea::placeholder { color: #94a3b8; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-with-btn { display: flex; gap: 10px; align-items: flex-end; }
.flex-1 { flex: 1; }

/* ═══════════════════════════════════════════
   AUTH VIEW
   ═══════════════════════════════════════════ */
.view-auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-left {
  display: flex;
  flex-direction: column;
  padding: 40px;
  background: linear-gradient(135deg, #312e81 0%, #4338ca 50%, #6366f1 100%);
  color: #fff;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
}

.auth-left-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 480px;
}

.auth-left-content h1 {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.auth-left-content p {
  font-size: 16px;
  color: rgba(255,255,255,0.8);
  line-height: 1.7;
  margin-bottom: 32px;
}

.auth-features { display: grid; gap: 14px; }
.feature-item { display: flex; align-items: center; gap: 12px; font-size: 14px; color: rgba(255,255,255,0.9); }
.feature-dot { width: 8px; height: 8px; border-radius: 50%; background: #a5b4fc; flex-shrink: 0; }

.auth-left-footer {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

.auth-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--bg);
}

.auth-form {
  width: 100%;
  max-width: 400px;
  display: none;
  flex-direction: column;
  gap: 16px;
}
.auth-form.active { display: flex; }

.auth-form h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.auth-form > p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: -8px;
  margin-bottom: 8px;
}

.auth-footer-links {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}

/* ═══════════════════════════════════════════
   APP VIEW
   ═══════════════════════════════════════════ */
.view-app { display: none; min-height: 100vh; flex-direction: column; }
.view-app.active { display: flex; }

.app-nav {
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  margin-right: 48px;
}

.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
}
.nav-link:hover { color: var(--text); background: #f1f5f9; }
.nav-link.active { color: var(--primary); background: var(--primary-soft); }

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.app-content {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

.page { display: none; }
.page.active { display: block; }

.page-head { margin-bottom: 32px; }
.page-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 6px; }
.page-head p { color: var(--text-secondary); font-size: 15px; }

/* ─── Dashboard ─── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 700; }

.dash-cta { display: flex; gap: 12px; }

/* ─── Cards & Panels ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.card-header h3 { font-size: 16px; font-weight: 600; }

.draft-status {
  font-size: 12px;
  color: var(--success);
  font-weight: 500;
}

/* ─── Form Hints ─── */
.form-hint {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
}
.form-hint strong { display: block; margin-bottom: 4px; }
.form-hint-info { background: #eef2ff; border: 1px solid #c7d2fe; color: #4338ca; }
.form-hint-warning { background: #fef3c7; border: 1px solid #fde68a; color: #92400e; }

.empty-box {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ─── Application Form ─── */
.app-form { display: grid; gap: 16px; }
.app-form .row-2 { gap: 16px; }
.form-section { margin-top: 8px; }
.form-section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.form-actions { display: flex; gap: 12px; margin-top: 8px; }

/* ─── Status Badge ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-withdrawn { background: #f1f5f9; color: #475569; }

/* ─── Event Cards ─── */
.event-grid { display: grid; gap: 16px; }

.event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.event-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }

.event-info h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.event-meta { display: flex; gap: 16px; flex-wrap: wrap; }
.event-meta span { font-size: 13px; color: var(--text-secondary); }

.event-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ─── Orders Table ─── */
.orders-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.orders-table th, .orders-table td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.orders-table th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: #f8fafc;
}
.orders-table tr:last-child td { border-bottom: none; }

/* ─── Application Status Card ─── */
.status-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.status-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}
.status-panel-head h3 { font-size: 16px; font-weight: 600; }
.status-panel-body { padding: 24px; }
.status-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.status-detail-item span { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.status-detail-item strong { font-size: 14px; font-weight: 500; }

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 900px) {
  .view-auth { grid-template-columns: 1fr; }
  .auth-left { display: none; }
  .auth-right { min-height: 100vh; }
  .stat-grid { grid-template-columns: 1fr; }
  .app-nav { padding: 0 16px; }
  .nav-brand { margin-right: 16px; }
  .nav-brand span { display: none; }
  .nav-link { padding: 8px 10px; font-size: 13px; }
  .app-content { padding: 24px 16px 60px; }
  .event-card { flex-direction: column; align-items: flex-start; }
  .status-detail-grid { grid-template-columns: 1fr; }
  .row-2 { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .nav-links { overflow-x: auto; }
  .nav-user span { display: none; }
  .dash-cta { flex-direction: column; }
  .auth-form { padding: 0 8px; }
}

/* ═══════════════════════════════════════════
   EVENT DETAIL & PURCHASE
   ═══════════════════════════════════════════ */

.event-detail { display: grid; gap: 24px; }

.event-detail-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.back-link {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 16px;
  display: inline-block;
}
.back-link:hover { color: var(--primary); }

.event-detail-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.event-detail-title h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
}

.event-detail-meta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ─── Items Grid ─── */
.items-grid {
  display: grid;
  gap: 12px;
}

.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  transition: border-color var(--transition);
}
.item-card:hover { border-color: var(--primary); }
.item-card.sold-out { opacity: 0.6; }

.item-info { flex: 1; min-width: 0; }
.item-info h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px;
}

.item-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-secondary);
}

.item-remark {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* ─── Quantity Control ─── */
.qty-control {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.qty-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: none;
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
}
.qty-btn:hover { background: #e2e8f0; }

.qty-input {
  width: 50px;
  height: 36px;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ─── Cart Summary ─── */
.cart-summary {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  z-index: 50;
}

.cart-info {
  font-size: 15px;
  font-weight: 500;
}
.cart-info span {
  color: var(--primary);
  font-weight: 700;
}

/* ─── Responsive for Event Detail ─── */
@media (max-width: 700px) {
  .item-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .item-actions {
    width: 100%;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }
  .cart-summary {
    padding: 12px 16px;
  }
  .event-detail-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

