/* assets/css/style.css */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:    #e63946;
  --primary-dk: #c1121f;
  --success:    #2a9d8f;
  --warning:    #e9c46a;
  --danger:     #e76f51;
  --dark:       #1d2d35;
  --light:      #f4f4f4;
  --card-bg:    #ffffff;
  --border:     #e0e0e0;
  --text:       #2b2d42;
  --muted:      #888;
  --radius:     14px;
  --shadow:     0 2px 16px rgba(0,0,0,.1);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--light);
  color: var(--text);
  min-height: 100vh;
}

/* ── CUSTOMER PAGE ──────────────────────────────── */
.customer-page {
  background: linear-gradient(135deg, #1d2d35 0%, #e63946 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.customer-container {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 40px 30px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
}

.restaurant-logo { margin-bottom: 24px; }
.restaurant-logo .logo-icon { font-size: 52px; display: block; }
.restaurant-logo h1 { font-size: 1.5rem; color: var(--dark); }

.table-badge {
  display: inline-flex;
  flex-direction: column;
  background: var(--primary);
  color: #fff;
  border-radius: 12px;
  padding: 12px 32px;
  margin: 16px 0;
}
.table-label  { font-size: 0.8rem; text-transform: uppercase; opacity: .85; }
.table-number { font-size: 2.4rem; font-weight: 800; line-height: 1; }

.waiter-info  { color: var(--muted); margin-bottom: 20px; }

.call-section { margin: 24px 0; }

.call-btn {
  width: 100%;
  padding: 20px;
  font-size: 1.3rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s;
  box-shadow: 0 4px 20px rgba(230,57,70,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.call-btn:hover:not(:disabled) { background: var(--primary-dk); transform: translateY(-2px); }
.call-btn:active:not(:disabled) { transform: translateY(0); }
.call-btn:disabled { background: #aaa; box-shadow: none; cursor: not-allowed; }
.call-btn.btn-success { background: var(--success); }
.call-btn.btn-cooldown { background: #888; }
.call-btn.btn-loading  { opacity: .75; }

@keyframes pulse-btn {
  0%,100% { box-shadow: 0 4px 20px rgba(42,157,143,.3); }
  50%      { box-shadow: 0 4px 40px rgba(42,157,143,.8); }
}
.call-btn.btn-pulse { animation: pulse-btn .6s ease-in-out 3; }

.btn-icon { font-size: 1.5rem; }

.status-msg {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  font-size: .95rem;
}
.status-success { background: #d1fae5; color: #065f46; }
.status-error   { background: #fee2e2; color: #991b1b; }

.note-section { margin-top: 20px; text-align: left; }
.note-section label { font-size: .9rem; color: var(--muted); display: block; margin-bottom: 6px; }
.note-section textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  resize: none;
  height: 80px;
  font-family: inherit;
  font-size: .95rem;
}

.cooldown-text { font-size: .85rem; color: var(--muted); margin-top: 8px; }

/* ── LOGIN PAGE ─────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1d2d35 0%, #2a9d8f 100%);
  padding: 20px;
}

.login-container {
  background: #fff;
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}
.login-header span { font-size: 3rem; display: block; margin-bottom: 8px; }
.login-header h2   { font-size: 1.4rem; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--dark);
}
.form-group input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border .2s;
}
.form-group input:focus { outline: none; border-color: var(--primary); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 13px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
}
.btn-primary:hover { background: var(--primary-dk); }
.btn-full { width: 100%; margin-top: 8px; }

/* ── WAITER DASHBOARD ───────────────────────────── */
.waiter-page { background: #f0f2f5; }

.waiter-header {
  background: var(--dark);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.waiter-header h1 { font-size: 1.2rem; }
.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.conn-status {
  font-size: .85rem;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
}
.conn-live         { background: #d1fae5; color: #065f46; }
.conn-reconnecting { background: #fee2e2; color: #991b1b; }
.conn-connecting   { background: #fef3c7; color: #92400e; }

.btn-logout {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 6px;
  padding: 6px 14px;
  text-decoration: none;
  font-size: .9rem;
  transition: background .2s;
}
.btn-logout:hover { background: rgba(255,255,255,.25); }

.waiter-main { padding: 20px; max-width: 900px; margin: 0 auto; }

.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-number { font-size: 2.5rem; font-weight: 800; color: var(--primary); display: block; }
.stat-label  { font-size: .85rem; color: var(--muted); }

.calls-section h2 {
  font-size: 1.2rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

@keyframes pulse-live {
  0%,100% { opacity:1; } 50% { opacity:.4; }
}
.badge-pulse {
  background: var(--primary);
  color: #fff;
  font-size: .7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  animation: pulse-live 1.2s ease-in-out infinite;
}

.call-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--primary);
  transition: opacity .35s, transform .35s;
}
@keyframes slideIn {
  from { opacity:0; transform: translateY(-16px); }
  to   { opacity:1; transform: translateY(0); }
}
.call-card-new      { animation: slideIn .4s ease-out forwards; }
.call-card-removing { opacity: 0; transform: translateX(60px); }

.call-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.call-table { font-size: 1.3rem; font-weight: 800; color: var(--primary); }
.call-time  { font-size: .85rem; color: var(--muted); }
.call-note  {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: .9rem;
  margin-bottom: 10px;
}
.call-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn-ack, .btn-dismiss {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: .9rem;
  transition: opacity .2s;
}
.btn-ack     { background: var(--success); color: #fff; }
.btn-dismiss { background: #e0e0e0; color: var(--text); }
.btn-ack:hover, .btn-dismiss:hover { opacity: .85; }

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
}
.empty-state span { font-size: 3rem; display: block; margin-bottom: 10px; }

/* ── ADMIN PAGE ─────────────────────────────────── */
.admin-page  { background: #f0f2f5; }
.admin-header {
  background: var(--dark);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-main  { padding: 20px; max-width: 1100px; margin: 0 auto; }
.admin-section { margin-bottom: 40px; }
.admin-section h2 { font-size: 1.2rem; margin-bottom: 16px; border-bottom: 2px solid var(--border); padding-bottom: 8px; }

.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.table-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.table-card-header {
  background: var(--dark);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.table-card-body  { padding: 14px 16px; font-size: .9rem; }
.table-card-body p { margin-bottom: 8px; }
.qr-link a { color: var(--primary); text-decoration: none; }

.assign-form { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.assign-form select {
  flex: 1;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .85rem;
}
.btn-small {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
}

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: capitalize;
}
.status-available   { background: #d1fae5; color: #065f46; }
.status-occupied    { background: #fee2e2; color: #991b1b; }
.status-reserved    { background: #fef3c7; color: #92400e; }
.status-pending     { background: #fee2e2; color: #991b1b; }
.status-acknowledged{ background: #d1fae5; color: #065f46; }
.status-dismissed   { background: #e5e7eb; color: #6b7280; }

.table-responsive { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: .9rem;
}
.data-table th {
  background: var(--dark);
  color: #fff;
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f9f9f9; }

/* ── ALERTS ─────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-weight: 600;
}
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error   { background: #fee2e2; color: #991b1b; }

/* ── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 600px) {
  .waiter-header  { padding: 12px 16px; }
  .header-right   { gap: 8px; }
  .waiter-greeting{ display: none; }
  .waiter-main    { padding: 12px; }
  .call-table     { font-size: 1.1rem; }
  .admin-main     { padding: 12px; }
  .stats-bar      { grid-template-columns: 1fr 1fr; }
}
/* ── CLEAN PANEL ────────────────────────────────── */
.clean-panel      { display: flex; flex-direction: column; gap: 14px; }

.clean-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--success);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.clean-card-danger { border-left-color: var(--danger); }

.clean-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}
.clean-info p      { font-size: .85rem; color: var(--muted); margin-top: 3px; }
.clean-icon        { font-size: 2rem; }

.btn-clean {
  padding: 10px 22px;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  transition: opacity .2s;
  white-space: nowrap;
}
.btn-clean:hover       { opacity: .85; }
.btn-clean-today       { background: var(--success); color: #fff; }
.btn-clean-all         { background: var(--danger);  color: #fff; }
.btn-clean:disabled    { opacity: .5; cursor: not-allowed; }
/* ── TABS ───────────────────────────────────────────── */
.dash-tabs {
  display:flex; gap:0; margin-bottom:16px;
  background:#fff; border-radius:var(--radius);
  overflow:hidden; box-shadow:var(--shadow);
}
.dash-tab {
  flex:1; padding:13px; border:none; background:#fff;
  cursor:pointer; font-size:.95rem; font-weight:600;
  color:var(--muted); border-bottom:3px solid transparent;
  transition:all .2s; position:relative;
}
.dash-tab.active        { color:var(--primary); border-bottom-color:var(--primary); }
.dash-tab.tab-flash     { animation:tab-flash .5s ease 3; }
@keyframes tab-flash    { 0%,100%{background:#fff} 50%{background:#fff3cd} }

.tab-badge {
  display:inline-flex; align-items:center; justify-content:center;
  background:var(--primary); color:#fff;
  border-radius:50%; width:20px; height:20px;
  font-size:.72rem; font-weight:800; margin-left:5px;
}

/* ── ORDER CARD ─────────────────────────────────────── */
.order-card {
  background:#fff; border-radius:var(--radius);
  margin-bottom:12px; box-shadow:var(--shadow);
  border-left:5px solid var(--warning);
  overflow:hidden;
}
.order-card.status-confirmed { border-left-color: #2a9d8f; }
.order-card.status-preparing { border-left-color: #e9c46a; }
.order-card.status-ready     { border-left-color: #4caf50; }

.order-card-header {
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  padding:12px 16px 6px; background:#fafafa;
  border-bottom:1px solid #f0f0f0;
}
.order-table      { font-size:1.1rem; font-weight:800; color:var(--primary); }
.order-id         { font-size:.8rem; color:var(--muted); }
.order-status-badge {
  background:#fff3cd; color:#856404;
  padding:2px 10px; border-radius:20px;
  font-size:.75rem; font-weight:700;
}
.order-time       { font-size:.8rem; color:var(--muted); margin-left:auto; }
.order-items-summary {
  padding:8px 16px; font-size:.88rem; color:var(--text);
  line-height:1.5;
}
.order-footer {
  display:flex; align-items:center; justify-content:space-between;
  padding:8px 16px 12px; flex-wrap:wrap; gap:8px;
}
.order-total      { font-size:1rem; font-weight:800; color:var(--dark); }
.order-actions    { display:flex; gap:8px; }
/* ── RESERVATION ──────────────────────────────────── */
.reservation-row   { margin-top:10px; border-top:1px solid #f0f0f0; padding-top:10px; }
.res-active        { display:flex; flex-direction:column; gap:5px; }
.res-badge         { display:inline-block; background:#fee2e2; color:#991b1b;
                     font-weight:700; font-size:.78rem; padding:3px 10px;
                     border-radius:20px; width:fit-content; }
.res-name          { font-size:.85rem; color:#333; font-weight:600; }
.res-note          { font-size:.82rem; color:#666; }
.res-time          { font-size:.78rem; color:#aaa; }
.btn-unreserve     { background:#2a9d8f !important; margin-top:5px; }
.btn-reserve-toggle{ background:#e63946 !important; }
.btn-reserve-confirm{ background:#2a9d8f !important; }
.res-inputs        { margin-top:8px; display:flex; flex-direction:column; gap:6px; }
.res-inputs input  { padding:7px 10px; border:1.5px solid #ddd;
                     border-radius:7px; font-size:.85rem; width:100%; }

/* ── Past Orders Modal ─────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-box {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px 10px;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  background: #fff;
}
.modal-header h3  { margin: 0; font-size: 1rem; }
.modal-close {
  background: #f0f0f0; border: none;
  border-radius: 50%; width: 30px; height: 30px;
  font-size: .9rem; cursor: pointer;
}
.modal-body { padding: 14px 18px; }
.past-order-card {
  border: 1px solid #eee;
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
}
.past-order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f8f8;
  padding: 8px 12px;
  font-size: .82rem;
  flex-wrap: wrap;
  gap: 4px;
}
.past-order-items {
  margin: 0;
  padding: 8px 12px 8px 28px;
  font-size: .82rem;
  color: #555;
}
.past-order-items li { margin-bottom: 2px; }
.past-order-footer {
  padding: 8px 12px;
  background: #f0fafa;
  font-size: .84rem;
  border-top: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-mini {
  padding: 4px 10px;
  background: #2a9d8f;
  color: #fff;
  border-radius: 6px;
  font-size: .78rem;
  text-decoration: none;
  font-weight: 600;
}
.btn-mini:hover { background: #21867a; }


/* coupon css */
/* ── Coupon Stats Bar ── */
.coupon-stats-bar {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.coupon-stat-card {
  background: #fff; border: 1px solid #e8e5e0; border-radius: 8px;
  padding: 12px 20px; min-width: 120px; text-align: center;
}
.coupon-stat-card .stat-val {
  font-size: 1.4rem; font-weight: 700; color: #01696f;
}
.coupon-stat-card .stat-label {
  font-size: .75rem; color: #888; margin-top: 2px;
}

/* ── Table ── */
#couponsTable { width: 100%; border-collapse: collapse; font-size: .88rem; }
#couponsTable th {
  background: #f3f0ec; padding: 10px 12px; text-align: left;
  font-weight: 600; color: #555; border-bottom: 1px solid #ddd;
}
#couponsTable td {
  padding: 10px 12px; border-bottom: 1px solid #f0ede8; vertical-align: middle;
}
#couponsTable tr:hover td { background: #fafaf8; }

.coupon-code-badge {
  display: inline-block; padding: 3px 10px; background: #e8f4f3;
  border: 1px solid #01696f; border-radius: 4px;
  font-family: monospace; font-weight: 700; color: #01696f; letter-spacing: .05em;
}
.coupon-type-tag {
  display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: .75rem; font-weight: 600; margin-left: 4px;
}
.coupon-type-flat    { background: #e8f0fe; color: #2255cc; }
.coupon-type-percent { background: #fef3e2; color: #c47800; }

.badge-active   { background: #d4edda; color: #1a6b2a; padding: 2px 10px; border-radius: 12px; font-size:.78rem; font-weight:600; }
.badge-inactive { background: #f8d7da; color: #721c24; padding: 2px 10px; border-radius: 12px; font-size:.78rem; font-weight:600; }
.badge-expired  { background: #e2e3e5; color: #555;    padding: 2px 10px; border-radius: 12px; font-size:.78rem; font-weight:600; }

.usage-bar-wrap { min-width: 80px; }
.usage-bar-bg { background: #e8e5e0; border-radius: 4px; height: 6px; margin-top: 4px; }
.usage-bar-fill { background: #01696f; border-radius: 4px; height: 6px; transition: width .3s; }

/* ── Action buttons ── */
.coupon-action-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-edit   { padding: 4px 10px; background: #01696f; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: .78rem; }
.btn-toggle { padding: 4px 10px; background: #6c757d; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: .78rem; }
.btn-reset  { padding: 4px 10px; background: #e67e22; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: .78rem; }
.btn-delete { padding: 4px 10px; background: #dc3545; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: .78rem; }

/* ── Form rows ── */
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: .82rem; font-weight: 600; color: #444; margin-bottom: 4px; }
.form-group input, .form-group select {
  width: 100%; padding: 8px 10px; border: 1px solid #ddd; border-radius: 6px;
  font-size: .88rem; background: #fff;
}
.form-group small { font-size: .75rem; color: #888; }
.req { color: #e63946; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-box {
  background: #fff; border-radius: 10px; padding: 24px; width: 100%;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h3 { margin: 0; font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: #888; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* coupon section end */
