/* Asre Woods Manufacturing ERP - Classic & Smooth Premium Design System */
:root {
  --brown: #4a2e1b;
  --brown2: #331e11;
  --cream: #f6f0ea;
  --paper: #ffffff;
  --gold: #c68a4c;
  --gold-hover: #b07437;
  --green: #2d6a4f;
  --green-light: #e8f5e9;
  --red: #a43a2b;
  --red-light: #ffebee;
  --muted: #7a685b;
  --line: #e4d7ca;
  --shadow: 0 10px 30px rgba(51, 30, 17, 0.08);
  --shadow-hover: 0 16px 36px rgba(51, 30, 17, 0.14);
  --sidebar-width: 260px;
  --radius: 16px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--cream);
  color: var(--brown2);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  outline: none;
}

.hidden {
  display: none !important;
}

/* Custom Smooth Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(74, 46, 27, 0.05);
}
::-webkit-scrollbar-thumb {
  background: #d4c2b2;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

/* App Main Layout */
#app {
  display: flex;
  min-height: 100vh;
}

/* Classic Sidebar Navigation */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #2b180d 0%, #3a2214 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  box-shadow: 6px 0 24px rgba(0,0,0,0.18);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  padding: 20px 18px;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.sidebar-header strong {
  font-size: 17px;
  display: block;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #f7ebe1;
}

.sidebar-header small {
  font-size: 11px;
  color: #d6b08b;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.nav-group-title {
  padding: 16px 22px 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #c68a4c;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 22px;
  color: #e5d5c7;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-left: 4px solid transparent;
  transition: var(--transition);
  background: transparent;
  width: 100%;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav-item.active {
  background: rgba(198, 138, 76, 0.18);
  color: #ffffff;
  border-left-color: var(--gold);
  font-weight: 700;
}

.nav-item .icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar-user {
  padding: 16px 20px;
  background: rgba(0,0,0,0.3);
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-user-info strong {
  display: block;
  font-size: 13px;
  color: #f7ebe1;
}

.sidebar-user-info small {
  display: block;
  font-size: 11px;
  color: #c68a4c;
}

/* Main Container Area */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar Header */
.topbar {
  background: rgba(74, 46, 27, 0.95);
  backdrop-filter: blur(12px);
  color: white;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 4px 20px rgba(51, 30, 17, 0.15);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.topbar-title h2 {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.content-container {
  padding: 28px;
  max-width: 1360px;
  margin: 0 auto;
  width: 100%;
}

/* Smooth View Transitions */
.app-view {
  animation: fadeInUp 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Login Page Styling */
.login-screen {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at center, #fbf7f2 0%, #ede3d8 100%);
}

.login-card {
  width: min(450px, 100%);
  background: var(--paper);
  padding: 36px;
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(51, 30, 17, 0.12);
  text-align: center;
  border: 1px solid var(--line);
  animation: fadeInUp 0.4s ease forwards;
}

.login-card img {
  width: 140px;
  max-width: 70%;
  margin-bottom: 16px;
}

.login-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
  background: #eae0d5;
  padding: 5px;
  border-radius: 14px;
}

.login-tab-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  font-weight: 700;
  font-size: 13px;
  color: var(--brown2);
  transition: var(--transition);
}

.login-tab-btn.active {
  background: #ffffff;
  color: var(--brown);
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.pin-input {
  width: 100%;
  font-size: 34px;
  letter-spacing: 14px;
  text-align: center;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 16px;
  margin-bottom: 18px;
  background: #fffdfa;
  transition: var(--transition);
}

.pin-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(198, 138, 76, 0.18);
  outline: none;
}

/* Card Styling */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  transition: var(--transition);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}

.dash-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  text-align: left;
  transition: var(--transition);
}

.dash-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: #d8c4b2;
}

.dash-card h3 {
  margin: 10px 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--brown2);
}

.dash-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.dash-card b {
  font-size: 28px;
  color: var(--brown);
  display: block;
  margin-top: 8px;
  font-weight: 800;
}

/* Classic Buttons */
.primary, .secondary, .danger, .success, .gold-btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 20px;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 3px 8px rgba(0,0,0,0.06);
}

.primary { background: var(--brown); color: white; }
.secondary { background: #ebdcd0; color: var(--brown2); }
.success { background: var(--green); color: white; }
.danger { background: var(--red); color: white; }
.gold-btn { background: var(--gold); color: white; }
.wide { width: 100%; }

.primary:hover { background: #3c2415; transform: translateY(-1px); }
.secondary:hover { background: #e0cca9; }
.success:hover { background: #23543e; }
.danger:hover { background: #882f22; }
.gold-btn:hover { background: var(--gold-hover); }

/* Forms & Fields */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 7px;
  color: var(--brown2);
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--brown2);
  transition: var(--transition);
  font-size: 14px;
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3.5px rgba(198, 138, 76, 0.18);
  outline: none;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.priority {
  border: 2px solid #dcb58e;
  background: #fffbf5;
  padding: 20px;
  border-radius: 18px;
  margin-bottom: 20px;
}

.priority-title {
  color: var(--brown);
  font-weight: 800;
  margin-bottom: 14px;
  font-size: 16px;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0;
}

.check {
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 11px 16px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.check:hover {
  border-color: var(--gold);
  background: #fffdf9;
}

.check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brown);
}

/* Orders Cards & List */
.order-list {
  display: grid;
  gap: 16px;
}

.order-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 22px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.order-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.order-top {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.order-top strong {
  font-size: 18px;
  color: var(--brown);
}

.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 13px;
}

.meta b {
  color: var(--brown2);
  font-size: 14px;
  display: block;
  margin-top: 2px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

/* Badges & Tables */
.badge {
  padding: 6px 14px;
  border-radius: 999px;
  background: #ebdcd0;
  font-size: 12px;
  font-weight: 800;
  display: inline-block;
  letter-spacing: 0.3px;
}

.badge.unpaid { background: var(--red-light); color: var(--red); }
.badge.partially_paid { background: #fff3e0; color: #b78103; }
.badge.paid { background: var(--green-light); color: var(--green); }

.tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tabs button {
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 13px;
  color: var(--brown2);
  transition: var(--transition);
}

.tabs button.active, .tabs button:hover {
  background: var(--brown);
  color: white;
  border-color: var(--brown);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  background: #ffffff;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.data-table th {
  background: #f1e5d9;
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 800;
  color: var(--brown);
  border-bottom: 1px solid var(--line);
}

.data-table td {
  padding: 14px 18px;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s ease;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: #fcf8f3;
}

/* Kanban Production Board - Compact & Mouse Scrollable */
.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: 520px;
  cursor: grab;
  user-select: none;
  scroll-behavior: smooth;
}

.kanban-board:active {
  cursor: grabbing;
}

.kanban-col {
  flex: 0 0 235px;
  background: #f4e8dc;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.kanban-header {
  padding: 11px 14px;
  font-weight: 800;
  font-size: 14px;
  color: var(--brown);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.65);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

.kanban-cards {
  padding: 10px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kanban-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 11px 13px;
  box-shadow: 0 2px 8px rgba(51, 30, 17, 0.06);
  border-left: 4px solid var(--brown);
  cursor: pointer;
  transition: var(--transition);
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* Classic Modals & Toasts */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 18, 10, 0.65);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease forwards;
}

.modal-content {
  width: min(720px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--paper);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  border: 1px solid var(--line);
  animation: modalZoom 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalZoom {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  padding: 16px 24px;
  border-radius: 14px;
  color: white;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.info { background: var(--brown); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .grid, .grid-3 { grid-template-columns: 1fr; }
}
