/* Tako Reorder System - Styles */

:root {
  --c-primary: #2563eb;
  --c-primary-hover: #1d4ed8;
  --c-primary-light: #dbeafe;
  --c-bg: #f8fafc;
  --c-card: #ffffff;
  --c-text: #1e293b;
  --c-text-muted: #64748b;
  --c-border: #e2e8f0;
  --c-pending: #f59e0b;
  --c-pending-bg: #fef3c7;
  --c-purchasing: #3b82f6;
  --c-purchasing-bg: #dbeafe;
  --c-purchased: #10b981;
  --c-purchased-bg: #d1fae5;
  --c-delivered: #8b5cf6;
  --c-success: #10b981;
  --c-error: #ef4444;
  --c-warning: #f59e0b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.10), 0 4px 10px -4px rgba(0,0,0,0.05);
  --radius: 14px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Yu Gothic', sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
  position: sticky; top: 0; z-index: 100;
  background: var(--c-card);
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--c-border);
}
.header__container {
  max-width: 1400px; margin: 0 auto; padding: 0 1.5rem;
  height: 64px; display: flex; align-items: center; justify-content: space-between;
}
.header__brand { display: flex; align-items: center; gap: 0.75rem; }
.header__logo {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--c-primary), #7c3aed);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.7rem; font-weight: 700; letter-spacing: 1px;
}
.header__company { font-size: 1.1rem; font-weight: 600; }
.header__nav { display: flex; gap: 1rem; align-items: center; }
.header__link {
  color: var(--c-text-muted); text-decoration: none; font-size: 0.9rem;
  padding: 0.4rem 0.8rem; border-radius: var(--radius-sm);
  transition: var(--transition);
}
.header__link:hover, .header__link.active {
  background: var(--c-primary-light); color: var(--c-primary);
}

/* Main */
.container { max-width: 1400px; margin: 0 auto; padding: 2rem 1.5rem; }
.page-title { margin-bottom: 2rem; }
.page-title h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 0.4rem; }
.page-title p { color: var(--c-text-muted); }

/* Dashboard Cards (Landing) */
.dashboard-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem;
  max-width: 900px; margin: 3rem auto;
}
.dashboard-card {
  background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 2rem; text-align: center;
  text-decoration: none; color: inherit; box-shadow: var(--shadow-md);
  transition: var(--transition); cursor: pointer;
}
.dashboard-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.dashboard-card--disabled { opacity: 0.5; cursor: not-allowed; }
.dashboard-card--disabled:hover { transform: none; }
.dashboard-card__icon { font-size: 3rem; margin-bottom: 1rem; }
.dashboard-card__title { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.5rem; }
.dashboard-card__desc { color: var(--c-text-muted); font-size: 0.9rem; }
.dashboard-card__badge {
  display: inline-block; margin-top: 0.5rem; padding: 0.2rem 0.6rem;
  background: var(--c-pending-bg); color: var(--c-pending);
  border-radius: 100px; font-size: 0.75rem; font-weight: 600;
}

/* Product Grid */
.product-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem;
}

/* Product Card */
.product-card {
  background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  overflow: hidden; transition: var(--transition);
  display: flex; flex-direction: column;
}
.product-card:hover { box-shadow: var(--shadow-lg); }
.product-card__image {
  width: 100%; aspect-ratio: 4/3;
  background: linear-gradient(135deg, #e0e7ff, #f0f9ff);
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-text-muted); font-weight: 600; font-size: 1.2rem;
}
.product-card__image img { width: 100%; height: 100%; object-fit: cover; }
.product-card__body { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; }
.product-card__code {
  display: inline-block; background: var(--c-primary-light); color: var(--c-primary);
  font-size: 0.72rem; font-weight: 600; padding: 0.2rem 0.65rem;
  border-radius: 100px; margin-bottom: 0.6rem; align-self: flex-start;
}
.product-card__title { margin-bottom: 0.5rem; }
.product-card__title-en { font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.product-card__title-jp { font-size: 0.85rem; color: var(--c-text-muted); margin-top: 0.15rem; }
.product-card__title-fa { font-size: 0.8rem; color: var(--c-text-muted); margin-top: 0.15rem; direction: rtl; }
.product-card__meta {
  display: flex; justify-content: space-between; align-items: center;
  margin: 0.75rem 0; padding: 0.75rem 0;
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
}
.product-card__price { font-size: 1.3rem; font-weight: 700; }
.product-card__price small { font-size: 0.75rem; color: var(--c-text-muted); font-weight: 400; }
.product-card__weight {
  font-size: 0.82rem; color: var(--c-text-muted);
  background: var(--c-bg); padding: 0.2rem 0.6rem; border-radius: 100px;
}

/* Actions */
.product-card__actions { display: flex; gap: 0.4rem; margin-bottom: 0.75rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  padding: 0.5rem 0.9rem; border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); background: var(--c-card);
  color: var(--c-text); font-size: 0.82rem; font-weight: 500;
  cursor: pointer; transition: var(--transition); text-decoration: none;
  font-family: inherit;
}
.btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn--primary { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.btn--primary:hover { background: var(--c-primary-hover); color: #fff; }
.btn--sm { padding: 0.35rem 0.7rem; font-size: 0.75rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Stages (Pipeline) */
.stages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; margin-bottom: 0.75rem; }
.stage {
  text-align: center; padding: 0.5rem 0.3rem; border-radius: var(--radius-sm);
  background: var(--c-bg); border: 1px solid var(--c-border);
}
.stage__label {
  display: block; font-size: 0.62rem; font-weight: 600;
  margin-bottom: 0.15rem; text-transform: uppercase; letter-spacing: 0.3px;
}
.stage__value { display: block; font-size: 1.3rem; font-weight: 700; line-height: 1; }
.stage--pending .stage__label, .stage--pending .stage__value { color: var(--c-pending); }
.stage--purchasing .stage__label, .stage--purchasing .stage__value { color: var(--c-purchasing); }
.stage--purchased .stage__label, .stage--purchased .stage__value { color: var(--c-purchased); }
.stage--delivered .stage__label, .stage--delivered .stage__value { color: var(--c-delivered); }
.stage--highlight { animation: pulseHighlight 0.8s ease; }
@keyframes pulseHighlight {
  0%, 100% { background: var(--c-bg); }
  50% { background: var(--c-pending-bg); transform: scale(1.05); }
}

/* Order Input */
.order-section { display: flex; gap: 0.4rem; margin-bottom: 0.5rem; }
.order-input, .admin-input {
  flex: 1; min-width: 0; padding: 0.5rem 0.7rem;
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  font-size: 0.9rem; font-family: inherit; color: var(--c-text);
  outline: none; transition: var(--transition);
}
.order-input:focus, .admin-input:focus {
  border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-light);
}

/* Admin specific */
.admin-section {
  margin-top: 0.75rem; padding-top: 0.75rem;
  border-top: 1px dashed var(--c-border);
}
.admin-row {
  display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.4rem;
}
.admin-row label {
  font-size: 0.75rem; color: var(--c-text-muted);
  min-width: 80px; font-weight: 500;
}
.admin-row .admin-input { font-size: 0.8rem; padding: 0.35rem 0.5rem; }
.admin-row .btn { font-size: 0.72rem; padding: 0.3rem 0.6rem; }

/* History Accordion */
.history { border-top: 1px solid var(--c-border); margin-top: 0.75rem; padding-top: 0.5rem; }
.history-toggle {
  width: 100%; background: none; border: none; color: var(--c-primary);
  font-size: 0.8rem; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 0.35rem;
  padding: 0.4rem; transition: var(--transition); font-family: inherit;
}
.history-toggle:hover { color: var(--c-primary-hover); }
.history-toggle__icon { font-size: 0.65rem; transition: transform 0.3s ease; }
.history-toggle.open .history-toggle__icon { transform: rotate(180deg); }
.history-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.history-content.open { max-height: 800px; }
.history-table { padding: 0.4rem 0 0.2rem; }
.history-row {
  display: grid; grid-template-columns: 1.1fr 1fr 0.5fr 0.7fr; gap: 0.4rem;
  padding: 0.4rem 0.2rem; font-size: 0.75rem;
  border-bottom: 1px solid var(--c-border);
}
.history-row:last-child { border-bottom: none; }
.history-row--header {
  font-weight: 600; color: var(--c-text-muted);
  text-transform: uppercase; font-size: 0.62rem; letter-spacing: 0.3px;
}
.history-empty { text-align: center; padding: 0.75rem 0; color: var(--c-text-muted); font-size: 0.8rem; }

/* Modal (Gallery) */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--c-card); border-radius: var(--radius);
  max-width: 90vw; max-height: 90vh; overflow: auto;
  padding: 1.5rem; position: relative;
}
.modal__close {
  position: absolute; top: 0.75rem; right: 0.75rem;
  background: var(--c-bg); border: none; width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer; font-size: 1.2rem;
}
.modal__title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.modal__gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}
.modal__gallery img {
  width: 100%; height: auto; border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
}

/* Toast */
.toast {
  position: fixed; top: 80px; left: 50%;
  transform: translateX(-50%) translateY(-100px);
  padding: 0.75rem 1.5rem; border-radius: var(--radius-sm);
  color: #fff; font-size: 0.9rem; font-weight: 500;
  box-shadow: var(--shadow-lg); z-index: 2000; opacity: 0;
  transition: all 0.3s ease; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast--success { background: var(--c-success); }
.toast--error { background: var(--c-error); }
.toast--warning { background: var(--c-warning); }

/* Empty State */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--c-text-muted); }

/* Footer */
.footer {
  text-align: center; padding: 2rem; color: var(--c-text-muted);
  font-size: 0.84rem; border-top: 1px solid var(--c-border); margin-top: 3rem;
}

/* Responsive */
@media (max-width: 1200px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .product-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .container { padding: 1rem; }
  .header__company { font-size: 0.95rem; }
  .page-title h1 { font-size: 1.4rem; }
  .stages { grid-template-columns: repeat(2, 1fr); }
}