/* public/css/style.css - Mobile-first, cross-platform (no OS lock) */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #f59e0b;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --danger: #ef4444;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Tahoma, 'Noto Sans Thai', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header / Nav */
header { background: var(--card); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100; }
nav { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; max-width: 1200px; margin: 0 auto; position: relative; }
.logo { font-weight: 700; font-size: 1.25rem; color: var(--primary); }
.menu-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; }
nav ul { display: flex; list-style: none; gap: 8px; }
nav ul li a { padding: 8px 12px; border-radius: 6px; color: var(--text); }
nav ul li a:hover { background: var(--bg); text-decoration: none; }

/* Mobile nav */
@media (max-width: 768px) {
  .menu-toggle { display: block; }
  nav ul { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--card); box-shadow: var(--shadow); padding: 8px; }
  nav ul.open { display: flex; }
}

/* Hero */
.hero { text-align: center; padding: 48px 16px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
.hero h1 { font-size: 1.75rem; margin-bottom: 8px; }
.hero p { opacity: 0.9; margin-bottom: 20px; }
.btn { display: inline-block; padding: 10px 20px; border-radius: var(--radius); font-weight: 600; cursor: pointer; border: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #d97706; text-decoration: none; }
.btn-secondary { background: var(--card); color: var(--primary); border: 1px solid var(--border); }

/* Container */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }

/* Cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }

/* Service grid */
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.service-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; }
.service-card h3 { font-size: 1rem; margin-bottom: 6px; }
.service-card .price { font-size: 1.25rem; font-weight: 700; color: var(--primary); margin: 8px 0; }
.service-card .stock { font-size: 0.85rem; color: var(--muted); }
.service-card .stock.low { color: var(--danger); }
.service-card .desc { font-size: 0.9rem; color: var(--muted); flex: 1; margin-bottom: 12px; }
.service-card .actions { display: flex; gap: 8px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 4px; font-weight: 500; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 1rem;
}
.form-group input:focus { outline: none; border-color: var(--primary); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--bg); font-weight: 600; font-size: 0.9rem; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* Footer */
footer { text-align: center; padding: 24px 16px; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--border); margin-top: 40px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--muted); }

/* Responsive tables on mobile */
@media (max-width: 480px) {
  .hero h1 { font-size: 1.4rem; }
}

/* Language + currency switcher */
.locale-tools { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.locale-group { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.locale-link { padding: 5px 9px; font-size: 12px; font-weight: 600; color: #64748b; text-decoration: none; line-height: 1.3; white-space: nowrap; }
.locale-link:hover { background: #eef4fd; color: var(--primary); }
.locale-link.on { background: var(--primary); color: #fff; }

/* Locale dropdown */
.locale-dropdown { position: relative; display: inline-block; }
.locale-drop-btn { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 600; color: #64748b; cursor: pointer; line-height: 1.3; }
.locale-drop-panel { position: absolute; top: calc(100% + 6px); right: 0; min-width: 170px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.12); padding: 6px; display: none; z-index: 200; flex-direction: column; gap: 2px; }
.locale-drop-panel.open { display: flex; }
.locale-drop-group { font-size: 11px; font-weight: 700; color: #94a3b8; text-transform: uppercase; padding: 6px 8px 4px; letter-spacing: .04em; }
.locale-drop-item { padding: 7px 10px; border-radius: 6px; font-size: 13px; color: #334155; text-decoration: none; }
.locale-drop-item:hover { background: #eef4fd; color: var(--primary); }
.locale-drop-item.on { background: var(--primary); color: #fff; }

/* Auth modal */
.auth-modal { position: fixed; inset: 0; z-index: 999; display: none; }
.auth-modal.open { display: block; }
.auth-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.auth-modal-card { position: relative; max-width: 400px; margin: 8vh auto 0; background: #fff; border-radius: 14px; padding: 24px 22px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.auth-modal-close { position: absolute; top: 8px; right: 12px; background: none; border: 0; font-size: 24px; cursor: pointer; color: #94a3b8; line-height: 1; }
.auth-modal-card h3 { margin: 0 0 14px; }

/* Fallback: show dropdown panel on hover/focus if JS fails */
.locale-dropdown:hover .locale-drop-panel, .locale-dropdown:focus-within .locale-drop-panel { display: flex; }
