/* ==========================================================================
   PESONA LAUNDRY - STYLESHEET RESMI (PURE CSS)
   Palet Warna Brand:
   --color-1: #6366f1 | --color-2: #0e119e | --color-3: #1418de
   --color-4: #4a4def | --color-5: #8a8cf4
   ========================================================================== */

:root {
  --color-1: #6366f1;
  --color-2: #0e119e;
  --color-3: #1418de;
  --color-4: #4a4def;
  --color-5: #8a8cf4;

  /* Token semantik */
  --color-primary: var(--color-1);
  --color-primary-dark: var(--color-2);
  --color-primary-strong: var(--color-3);
  --color-primary-medium: var(--color-4);
  --color-primary-soft: var(--color-5);

  /* Netral dan Status */
  --color-white: #ffffff;
  --color-background: #f8f8ff;
  --color-surface: #ffffff;
  --color-text: #17172b;
  --color-text-muted: #62627a;
  --color-border: #e3e4f5;
  --color-success: #2e7d32;
  --color-warning: #ed6c02;
  --color-danger: #c62828;
  --color-info: #0284c7;

  /* Layout and Dimension */
  --sidebar-width: 260px;
  --navbar-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(14, 17, 158, 0.05);
  --shadow-md: 0 4px 12px rgba(14, 17, 158, 0.08);
  --shadow-lg: 0 10px 25px rgba(14, 17, 158, 0.12);
  --font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

html, body {
  min-width: 360px;
  font-family: var(--font-family);
  font-size: 15px;
  color: var(--color-text);
  background-color: var(--color-background);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  zoom: 80%;
}

body.auth-page {
  zoom: 95%;
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Desktop */
.app-sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--color-primary-dark) 0%, #0a0c6e 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  box-shadow: 2px 0 14px rgba(14, 17, 158, 0.15);
  overflow-y: auto;
}

.sidebar-header {
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  gap: 0.75rem;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #ffffff;
}

.logo-badge {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-strong));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.logo-text {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-subtext {
  font-size: 0.72rem;
  color: var(--color-primary-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
  padding: 0.75rem 0.75rem 0.35rem;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

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

.nav-link.active {
  color: #ffffff;
  background: var(--color-primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-badge-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #ffffff;
  font-size: 0.85rem;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffffff;
}

.user-role {
  font-size: 0.72rem;
  color: var(--color-primary-soft);
  text-transform: capitalize;
}

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

.app-navbar {
  height: var(--navbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.navbar-page-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-content {
  flex: 1;
  padding: 1.5rem;
}

/* Bottom Nav Mobile */
.bottom-nav {
  display: none;
}

/* ==========================================================================
   CARDS, TABLES, GRIDS
   ========================================================================== */

.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

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

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--color-background);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  flex-shrink: 0;
}

.stat-icon.primary { background: #e0e7ff; color: var(--color-primary); }
.stat-icon.success { background: #dcfce7; color: var(--color-success); }
.stat-icon.warning { background: #fef3c7; color: var(--color-warning); }
.stat-icon.danger { background: #fee2e2; color: var(--color-danger); }
.stat-icon.info { background: #e0f2fe; color: var(--color-info); }

.stat-info {
  flex: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--color-text);
  line-height: 1.2;
  margin-top: 0.2rem;
}

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

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

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  background: var(--color-background);
  color: var(--color-text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
  vertical-align: middle;
}

.table tr:hover td {
  background: #fbfbff;
}

/* ==========================================================================
   BUTTONS, BADGES, FORMS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  min-height: 38px;
}

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

.btn-primary:hover {
  background: var(--color-primary-medium);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.btn-dark {
  background: var(--color-primary-dark);
  color: #ffffff;
}

.btn-dark:hover {
  background: #090b7a;
}

.btn-success {
  background: var(--color-success);
  color: #ffffff;
}

.btn-success:hover {
  background: #256628;
}

.btn-whatsapp {
  background: #25D366;
  color: #ffffff;
}

.btn-whatsapp:hover {
  background: #1ebc59;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.35);
}

.btn-whatsapp-outline {
  background: transparent;
  border: 1px solid #25D366;
  color: #128C7E;
}

.btn-whatsapp-outline:hover {
  background: rgba(37, 211, 102, 0.12);
  color: #075E54;
}

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

.btn-danger:hover {
  background: #a81e1e;
}

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

.btn-outline:hover {
  background: var(--color-background);
  border-color: #cbd5e1;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover {
  background: var(--color-background);
  color: var(--color-text);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  min-height: 30px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  line-height: 1.2;
}

/* Status Operasional */
.badge-diterima { background: #e0e7ff; color: var(--color-primary-dark); }
.badge-dicuci { background: #e0f2fe; color: #0369a1; }
.badge-dikeringkan { background: #fef3c7; color: #92400e; }
.badge-disetrika { background: #f3e8ff; color: #6b21a8; }
.badge-siap_diambil { background: #ccfbf1; color: #0f766e; font-weight: 700; }
.badge-selesai { background: #dcfce7; color: var(--color-success); font-weight: 700; }
.badge-dibatalkan { background: #fee2e2; color: var(--color-danger); text-decoration: line-through; }

/* Status Pembayaran */
.badge-belum_bayar { background: #fee2e2; color: var(--color-danger); }
.badge-belum_lunas { background: #fef3c7; color: #92400e; }
.badge-lunas { background: #dcfce7; color: var(--color-success); }

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--color-text);
}

.form-control, .form-select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--color-text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.form-control[readonly] {
  background: var(--color-background);
  cursor: not-allowed;
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-wrapper .form-control {
  padding-right: 2.75rem;
}

.password-toggle-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background-color 0.2s;
  line-height: 1;
}

.password-toggle-btn:hover {
  color: var(--color-primary);
}

.password-toggle-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.form-text {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

.form-error {
  font-size: 0.78rem;
  color: var(--color-danger);
  margin-top: 0.25rem;
}

/* Alerts */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.alert-danger { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(14, 17, 158, 0.45);
  backdrop-filter: blur(3px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.is-active {
  display: flex;
}

.modal-dialog {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
}

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

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--color-border);
}

/* ==========================================================================
   PRINT STYLESHEET (NOTA LAUNDRY)
   ========================================================================== */

@media print {
  .app-sidebar,
  .app-navbar,
  .bottom-nav,
  .btn,
  .no-print {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
    margin: 0;
    padding: 0;
  }

  .app-main {
    margin-left: 0 !important;
  }

  .app-content {
    padding: 0 !important;
  }

  .receipt-container {
    width: 100% !important;
    max-width: 80mm !important; /* thermal standard */
    margin: 0 auto !important;
    padding: 10px !important;
    border: none !important;
    box-shadow: none !important;
  }
}

/* ==========================================================================
   RESPONSIVE DESIGN (BREAKPOINT: 768px)
   ========================================================================== */

@media (max-width: 767px) {
  .app-sidebar {
    display: none;
  }

  .app-main {
    margin-left: 0;
  }

  .app-content {
    padding: 1rem 0.85rem calc(88px + env(safe-area-inset-bottom));
  }

  .bottom-nav {
    display: grid;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 999;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -4px 12px rgba(14, 17, 158, 0.08);
  }

  .bottom-nav__item {
    min-width: 0;
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease;
  }

  .bottom-nav__item.is-active {
    color: var(--color-primary-dark);
    font-weight: 700;
  }

  .bottom-nav__item.is-active svg {
    color: var(--color-primary);
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .navbar-actions {
    gap: 0.4rem;
  }
}

@media (min-width: 768px) {
  .bottom-nav {
    display: none !important;
  }
}
