/* ===================================================================
   Shared stylesheet for the "no sidebar" screens: login, select-tenant,
   select-mode and pos. Colors/variables now live in ONE place (main.css's
   :root / html.dark), this file only holds page-specific layout so nothing
   is redefined three times across separate <style> blocks anymore.
   =================================================================== */

html, body.auth-shell {
  font-family: 'Tajawal', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background-color var(--duration-base) var(--ease-in-out), color var(--duration-base) var(--ease-in-out);
}

@keyframes auth-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

body.auth-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

body.auth-shell.auth-shell-column {
  flex-direction: column;
}

/* Shared top-left controls (theme + exit) on the tenant/mode picker screens */
.top-bar {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  gap: 10px;
}

.btn-nav {
  background: transparent;
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 600;
  transition: background-color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}

.btn-nav:hover {
  background: var(--bg-card);
  border-color: var(--primary-green);
  color: var(--primary-green);
  transform: translateY(-1px);
}

/* ===================================
   Login
   =================================== */
.login-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: auth-in var(--duration-slow) var(--ease-out) both;
}

.brand-title {
  text-align: center;
  font-size: 28px;
  font-weight: 900;
  color: var(--primary-green);
  margin-bottom: 8px;
}

.brand-subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin-bottom: 24px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  cursor: pointer;
}

.forgot-link {
  color: var(--primary-green);
  text-decoration: none;
  font-weight: 600;
}

.btn-login {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--primary-green);
  color: white;
  border: none;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
  box-shadow: var(--shadow-sm);
}

.btn-login:hover {
  background: var(--primary-green-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-login:active {
  transform: translateY(0);
  background: var(--primary-green-active);
}

.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.theme-toggle {
  position: absolute;
  top: 20px;
  left: 20px;
  background: transparent;
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  transition: background-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}

.theme-toggle:hover {
  background: var(--bg-page);
  transform: rotate(-8deg);
}

/* ===================================
   Select tenant / select mode (shared container)
   =================================== */
.container {
  width: 100%;
  max-width: 650px;
  text-align: center;
  animation: auth-in var(--duration-slow) var(--ease-out) both;
}

.container.container-wide {
  max-width: 900px;
}

.header-title {
  font-size: 28px;
  font-weight: 900;
  color: var(--primary-green);
  margin-bottom: 8px;
}

.header-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 32px;
}

/* Tenant picker */
.tenants-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tenant-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
  box-shadow: var(--shadow-xs);
}

.tenants-list .tenant-card {
  animation: content-in var(--duration-slow) var(--ease-out) both;
}

.tenants-list .tenant-card:nth-child(2) { animation-delay: 60ms; }
.tenants-list .tenant-card:nth-child(3) { animation-delay: 120ms; }

.tenant-card:hover {
  border-color: var(--primary-green);
  transform: translateX(-4px);
  box-shadow: var(--shadow-md);
}

.tenant-card:active {
  transform: translateX(-2px) scale(0.99);
}

.tenant-info {
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: right;
}

.tenant-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(5, 150, 105, 0.1);
  color: var(--primary-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 20px;
  transition: transform var(--duration-fast) var(--ease-out);
}

.tenant-card:hover .tenant-avatar {
  transform: scale(1.06);
}

.tenant-name {
  font-size: 18px;
  font-weight: 800;
}

.tenant-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-enter {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  background: var(--primary-green);
  color: white;
  border: none;
  font-weight: 700;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}

.btn-enter:hover {
  background: var(--primary-green-hover);
  transform: scale(1.03);
}

/* Mode picker */
.modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.mode-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  cursor: pointer;
  transition: border-color var(--duration-base) var(--ease-out), transform var(--duration-base) var(--ease-out), box-shadow var(--duration-base) var(--ease-out);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: var(--shadow-xs);
}

.modes-grid .mode-card {
  animation: content-in var(--duration-slow) var(--ease-out) both;
}

.modes-grid .mode-card:nth-child(2) { animation-delay: 70ms; }
.modes-grid .mode-card:nth-child(3) { animation-delay: 140ms; }

.mode-card:hover {
  border-color: var(--primary-green);
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.mode-icon {
  font-size: 48px;
  margin-bottom: 16px;
  transition: transform var(--duration-base) var(--ease-out);
}

.mode-card:hover .mode-icon {
  transform: scale(1.08) translateY(-2px);
}

.mode-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
}

.mode-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.btn-select {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(5, 150, 105, 0.1);
  color: var(--primary-green);
  border: none;
  font-weight: 700;
  transition: background-color var(--duration-base) var(--ease-out), color var(--duration-base) var(--ease-out);
}

.mode-card:hover .btn-select {
  background: var(--primary-green);
  color: white;
}

/* ===================================
   Point of sale
   =================================== */
body.pos-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.pos-container {
  display: flex;
  width: 100%;
  height: 100vh;
}

.products-section {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.pos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--shadow-xs);
  animation: content-in var(--duration-base) var(--ease-out) both;
}

.search-bar {
  width: 100%;
  max-width: 350px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-page);
  color: var(--text-primary);
  outline: none;
}

.categories-bar {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.cat-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}

.cat-btn:hover {
  border-color: var(--primary-green);
  color: var(--primary-green);
  transform: translateY(-1px);
}

.cat-btn.active {
  background: var(--primary-green);
  color: white;
  border-color: var(--primary-green);
}

.cat-btn.active:hover {
  color: white;
  transform: none;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
  user-select: none;
  box-shadow: var(--shadow-xs);
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary-green);
  box-shadow: var(--shadow-md);
}

.product-card:active {
  transform: translateY(-1px) scale(0.98);
}

.product-title {
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 8px;
}

.product-price {
  color: var(--primary-green);
  font-weight: 800;
  font-size: 15px;
}

.cart-section {
  width: 380px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cart-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  font-weight: bold;
  font-size: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-page);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  animation: content-in var(--duration-base) var(--ease-out) both;
}

.item-qty-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  cursor: pointer;
  font-weight: bold;
  transition: background-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}

.item-qty-btn:hover {
  background: var(--primary-green);
  color: white;
  border-color: var(--primary-green);
  transform: scale(1.08);
}

.cart-footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
}

.summary-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
}

.total-line {
  display: flex;
  justify-content: space-between;
  font-size: 20px;
  font-weight: 900;
  color: var(--primary-green);
  margin: 12px 0;
}

.btn-pay {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--primary-green);
  color: white;
  border: none;
  font-weight: 800;
  font-size: 18px;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
  box-shadow: var(--shadow-sm);
}

.btn-pay:hover {
  background: var(--primary-green-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-pay:active {
  transform: translateY(0);
}

.btn-pay:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 900px) {
  .pos-container {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }
  body.pos-shell {
    height: auto;
    overflow: visible;
  }
  .cart-section {
    width: 100%;
    border-right: none;
    border-top: 1px solid var(--border-color);
  }
}

@media (max-width: 480px) {
  .top-bar {
    position: static;
    justify-content: center;
    margin-bottom: 16px;
  }
  body.auth-shell {
    flex-direction: column;
  }
}
