/* ==============================================================================
   TEXTILE SaaS Platform - Comprehensive Modern CSS
   Tailwind-Compatible, Mobile-First Design System for Textile Mill SaaS
   ============================================================================== */

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

:root {
  --primary: #0F172A;
  --primary-hover: #1E293B;
  --amber: #D97706;
  --amber-hover: #B45309;
  --whatsapp: #25D366;
  --whatsapp-hover: #1EBE5D;
  --bg-slate: #F8FAFC;
  --card-bg: #FFFFFF;
  --border-slate: #E2E8F0;
  --border-dark: #334155;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-slate);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Containers */
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px;
}

.container-narrow {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Navigation & Header */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-slate);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand-logo-text {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  font-family: inherit;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #FFF;
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.btn-secondary {
  background: #F1F5F9;
  color: #1E293B;
  border-color: #E2E8F0;
}
.btn-secondary:hover {
  background: #E2E8F0;
}

.btn-outline {
  background: #FFF;
  color: #334155;
  border-color: #CBD5E1;
}
.btn-outline:hover {
  background: #F8FAFC;
  border-color: #94A3B8;
}

.btn-amber {
  background: var(--amber);
  color: #FFF;
  font-weight: 700;
}
.btn-amber:hover {
  background: var(--amber-hover);
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.3);
}

.btn-whatsapp {
  background: var(--whatsapp);
  color: #FFF;
  font-weight: 700;
}
.btn-whatsapp:hover {
  background: var(--whatsapp-hover);
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
}

.btn-danger {
  background: #EF4444;
  color: #FFF;
}
.btn-danger:hover {
  background: #DC2626;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 24px;
  font-size: 16px;
  border-radius: 12px;
}

.btn-block {
  width: 100%;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9999px;
  border: 1px solid transparent;
}
.badge-success { background: #ECFDF5; color: #059669; border-color: #A7F3D0; }
.badge-amber { background: #FEF3C7; color: #B45309; border-color: #FDE68A; }
.badge-danger { background: #FEF2F2; color: #DC2626; border-color: #FECACA; }
.badge-neutral { background: #F1F5F9; color: #475569; border-color: #E2E8F0; }
.badge-dark { background: #0F172A; color: #FFF; }

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-slate);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  overflow: hidden;
}

.card-hover {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px -4px rgba(15, 23, 42, 0.08);
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-slate);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFF;
}

.card-body {
  padding: 24px;
}

.card-footer {
  padding: 16px 24px;
  background: #F8FAFC;
  border-top: 1px solid var(--border-slate);
}

/* Digital Shade Book Swatch Cards */
.swatch-card {
  background: #FFF;
  border: 1px solid var(--border-slate);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.swatch-image-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.swatch-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}
.swatch-card:hover .swatch-image-container img {
  transform: scale(1.06);
}

.shade-number-pill {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(4px);
  color: #FFF;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 800;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  letter-spacing: 0.5px;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #475569;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  border: 1px solid #CBD5E1;
  border-radius: var(--radius-md);
  background: #FFF;
  color: #0F172A;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.form-helper {
  font-size: 11px;
  color: #64748B;
  margin-top: 5px;
}

/* Metre Quantity Stepper */
.metre-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.metre-btn {
  width: 40px;
  height: 40px;
  border: 1px solid #CBD5E1;
  background: #FFF;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #334155;
  transition: all 0.1s ease;
}
.metre-btn:hover {
  background: #F1F5F9;
  border-color: #94A3B8;
}

.metre-input-wrapper {
  position: relative;
  flex: 1;
}

.metre-input {
  width: 100%;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  padding: 8px 36px 8px 12px;
  border: 1px solid #CBD5E1;
  border-radius: var(--radius-md);
  font-family: inherit;
}
.metre-input:focus {
  outline: none;
  border-color: var(--primary);
}

.metre-unit-tag {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 700;
  color: #94A3B8;
  pointer-events: none;
}

/* Layouts & Grids */
.grid {
  display: grid;
  gap: 20px;
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

@media (max-width: 1024px) {
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .grid-5, .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .grid-swatches-mobile { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* Modern Dashboard Layout */
.dashboard-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: #0F172A;
  color: #E2E8F0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 24px 20px 18px;
  border-bottom: 1px solid #1E293B;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-nav {
  padding: 16px 12px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #94A3B8;
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  transition: all 0.15s ease;
}

.sidebar-nav a:hover {
  color: #FFF;
  background: #1E293B;
}

.sidebar-nav a.active {
  color: #FFF;
  background: #1E293B;
  border-left: 3px solid var(--amber);
  font-weight: 700;
}

.sidebar-footer {
  padding: 18px 20px;
  border-top: 1px solid #1E293B;
  background: #0B1120;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.topbar {
  height: 68px;
  background: #FFF;
  border-bottom: 1px solid var(--border-slate);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Cart Slide-Over Drawer */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 50;
}

.drawer {
  position: fixed;
  top: 0;
  right: -440px;
  width: 100%;
  max-width: 440px;
  height: 100vh;
  background: #FFF;
  box-shadow: -6px 0 30px rgba(0, 0, 0, 0.18);
  z-index: 55;
  display: flex;
  flex-direction: column;
  transition: right 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer.open {
  right: 0;
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-slate);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F8FAFC;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.drawer-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-slate);
  background: #F8FAFC;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  z-index: 60;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 560px;
  background: #FFF;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* Alert Notices */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.alert-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-danger { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-amber { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
