/* Google Fonts - Inter */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --background: #f8fafc;
  --foreground: #0f172a;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --popover: #ffffff;
  --popover-foreground: #0f172a;
  --primary: #4f46e5;
  --primary-foreground: #ffffff;
  --secondary: #f1f5f9;
  --secondary-foreground: #0f172a;
  --muted: #f8fafc;
  --muted-foreground: #64748b;
  --accent: #f1f5f9;
  --accent-foreground: #0f172a;
  --destructive: #ef4444;
  --destructive-foreground: #ffffff;
  --border: #e2e8f0;
  --input: #f1f5f9;
  --ring: #4f46e5;
  --radius: 0.5rem;
}

.dark {
  --background: #0b0f19;
  --foreground: #f8fafc;
  --card: #151c2c;
  --card-foreground: #f8fafc;
  --popover: #151c2c;
  --popover-foreground: #f8fafc;
  --primary: #6366f1;
  --primary-foreground: #0b0f19;
  --secondary: #1e293b;
  --secondary-foreground: #f8fafc;
  --muted: #1e293b;
  --muted-foreground: #94a3b8;
  --accent: #1e293b;
  --accent-foreground: #f8fafc;
  --destructive: #ef4444;
  --destructive-foreground: #ffffff;
  --border: #273142;
  --input: #1e293b;
  --ring: #6366f1;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

body {
  background-color: var(--background);
  color: var(--foreground);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbar styles */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

/* App Layout */
.app-container {
  display: grid;
  min-height: 100vh;
  grid-template-cols: 260px 1fr;
}

@media (max-width: 768px) {
  .app-container {
    grid-template-cols: 1fr;
  }
}

/* Sidebar Styling */
.sidebar {
  background-color: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 40;
  transition: transform 0.3s ease;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    width: 260px;
  }
  .sidebar.open {
    transform: translateX(0);
  }
}

.sidebar-header {
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--foreground);
  text-decoration: none;
}

.logo svg {
  color: var(--primary);
  width: 24px;
  height: 24px;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  background-color: var(--secondary);
  color: var(--foreground);
}

.nav-item.active {
  background-color: var(--secondary);
  color: var(--primary);
  font-weight: 600;
  border-color: var(--border);
}

.nav-item svg {
  width: 18px;
  height: 18px;
}

/* Main Workspace area */
.main-area {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header / Topbar */
.topbar {
  height: 60px;
  background-color: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--foreground);
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Content Container */
.content {
  flex: 1;
  padding: 1.5rem;
  background-color: rgba(15, 23, 42, 0.02);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dark .content {
  background-color: rgba(15, 23, 42, 0.2);
}

/* Utility buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  background: none;
  color: var(--foreground);
  text-decoration: none;
}

.btn-sm {
  height: 1.75rem;
  font-size: 0.75rem;
  padding: 0 0.75rem;
}

.btn-icon-sm {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border-radius: 0.375rem;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-outline {
  border-color: var(--border);
  background-color: var(--card);
}

.btn-outline:hover {
  background-color: var(--secondary);
}

.btn-danger-outline {
  border-color: var(--destructive);
  color: var(--destructive);
}

.btn-danger-outline:hover {
  background-color: var(--destructive);
  color: #ffffff;
}

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Cards layout */
.card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

.card-description {
  font-size: 0.825rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

.card-content {
  padding: 1.5rem;
}

/* Stat Cards Grid */
.grid-stats {
  display: grid;
  grid-template-cols: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

.stat-desc {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-blue { background-color: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.icon-green { background-color: rgba(16, 185, 129, 0.1); color: #10b981; }
.icon-indigo { background-color: rgba(99, 102, 241, 0.1); color: #6366f1; }
.icon-amber { background-color: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.icon-red { background-color: rgba(239, 68, 68, 0.1); color: #ef4444; }

/* Grid Dashboard Main */
.grid-dashboard {
  display: grid;
  grid-template-cols: 4fr 3fr;
  gap: 1rem;
}

@media (max-width: 1024px) {
  .grid-dashboard {
    grid-template-cols: 1fr;
  }
}

/* General Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

th {
  background-color: var(--secondary);
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  font-size: 0.725rem;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:hover td {
  background-color: rgba(0,0,0,0.01);
}

.dark tr:hover td {
  background-color: rgba(255,255,255,0.01);
}

/* Status Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.725rem;
  font-weight: 600;
  border-radius: 9999px;
}

.badge-pending { background-color: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.badge-paid { background-color: rgba(16, 185, 129, 0.1); color: #10b981; }
.badge-shipped { background-color: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.badge-cancelled { background-color: rgba(239, 68, 68, 0.1); color: #ef4444; }

/* Form inputs styling */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}

.form-row-2 {
  display: grid;
  grid-template-cols: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 480px) {
  .form-row-2 {
    grid-template-cols: 1fr;
  }
}

label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
}

input, select, textarea {
  height: 2.25rem;
  padding: 0 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background-color: var(--background);
  color: var(--foreground);
  font-size: 0.875rem;
  outline: none;
  width: 100%;
}

textarea {
  height: auto;
  padding: 0.5rem 0.75rem;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

/* Modals layout */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}

.modal-content {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-t: 1px solid var(--border);
  background-color: var(--secondary);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Visibility helpers */
.hidden {
  display: none !important;
}

/* SVG Chart styles */
.chart-container {
  width: 100%;
  height: 320px;
}

/* Floating copy tooltip alert */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background-color: #10b981;
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 60;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* WhatsApp message block layout */
.wa-bubble {
  background-color: #e8f9f3;
  border: 1px solid #cbf0e3;
  padding: 1rem;
  border-radius: 0.75rem;
  border-top-left-radius: 0;
  font-size: 0.875rem;
  color: #1e293b;
  position: relative;
  min-height: 80px;
  white-space: pre-wrap;
}

.dark .wa-bubble {
  background-color: #0b1a14;
  border-color: #163e30;
  color: #f1f5f9;
}
