/* ---- app/style.css ---- */
* {
  box-sizing: border-box;
}

body {
  background: #f4f7fc;
  font-family: 'Segoe UI', Roboto, sans-serif;
  transition: background 0.2s;
  padding-bottom: 60px;
  margin: 0;
}

/* ---- Sidebar - Mobile Hamburger ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background: #1e293b;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
  z-index: 1060;
  overflow-y: auto;
  transition: left 0.3s ease;
  box-shadow: 4px 0 20px rgba(0,0,0,0.3);
}

.sidebar.open {
  left: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem 1rem 1.5rem;
  border-bottom: 1px solid #334155;
}

.sidebar-brand {
  font-weight: 700;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-close {
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-size: 1.2rem;
  padding: 0.2rem 0.5rem;
}

.sidebar-close:hover {
  background: #334155;
  border-radius: 4px;
}

.sidebar .nav {
  width: 100%;
  flex: 1;
  padding: 0.5rem;
}

.sidebar .nav-link {
  color: #cbd5e1;
  border-radius: 8px;
  margin: 0.1rem 0;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  white-space: nowrap;
  transition: 0.15s;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
}

.sidebar .nav-link i {
  width: 1.4rem;
  text-align: center;
  font-size: 1rem;
}

.sidebar .nav-link:hover {
  background: #334155;
  color: white;
}

.sidebar .nav-link.active {
  background: #3b82f6;
  color: white;
}

.sidebar-footer {
  padding: 0.5rem 1rem;
  width: 100%;
  border-top: 1px solid #334155;
}

.sidebar-footer .btn-outline-light {
  color: #cbd5e1;
  border-color: #475569;
}

.sidebar-footer .btn-outline-light:hover {
  background: #334155;
  border-color: #94a3b8;
  color: #ffffff;
}

/* Sidebar Overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1050;
  display: none;
}

.sidebar-overlay.active {
  display: block;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 1040;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  background: #3b82f6;
  border: none;
  color: white;
  font-size: 1.5rem;
}

.mobile-menu-btn:hover {
  background: #2563eb;
  color: white;
}

/* Main content */
.main-content {
  padding: 0.75rem;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
}

/* Page sections */
.page-section {
  display: none;
  animation: fadeUp 0.25s ease;
}

.page-section.active {
  display: block;
}

@keyframes fadeUp {
  0% {
    opacity: 0.4;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-title {
  font-size: 1.1rem;
  margin: 0;
}

/* Dashboard cards */
.dashboard-card {
  border-radius: 12px;
  border: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: 0.2s;
}

.dashboard-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.dashboard-card h4 {
  font-size: 1rem;
  font-weight: 700;
}

.dashboard-card h6 {
  font-size: 0.65rem;
  font-weight: 600;
}

/* Totals panel */
.totals-card .totals-line {
  display: flex;
  justify-content: space-between;
  padding: 0.2rem 0;
  border-bottom: 1px dashed #e9edf2;
}

.totals-card .grand-total {
  font-weight: 700;
  font-size: 1.1rem;
  border-bottom: 2px solid #1e293b;
  padding-top: 0.4rem;
  margin-top: 0.2rem;
}

.totals-card .totals-line span {
  font-size: 0.85rem;
}

.table th {
  background: #f8fafc;
  font-size: 0.7rem;
  font-weight: 600;
}

.table td {
  font-size: 0.8rem;
  vertical-align: middle;
}

.btn {
  border-radius: 20px;
  padding: 0.25rem 0.8rem;
  font-size: 0.8rem;
}

.btn-sm {
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
}

.form-control,
.form-select {
  border-radius: 20px;
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
}

.form-control-sm,
.form-select-sm {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  min-height: 30px;
}

.badge {
  border-radius: 20px;
  font-size: 0.7rem;
}

/* Date filter group */
.date-filter-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* Modal */
.modal-content {
  border-radius: 16px;
}

.modal-body {
  max-height: 60vh;
  overflow-y: auto;
}

.modal-body {
  padding: 1rem;
}

/* Logo upload */
#logoPreview {
  border: 1px dashed #dee2e6;
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
}

/* Business fields */
.business-field {
  transition: all 0.3s ease;
}

/* App Footer */
.app-footer {
  background: #f1f5f9;
  border-top: 1px solid #e2e8f0;
  margin-top: 2rem;
}

.app-footer a {
  color: #64748b;
  text-decoration: none;
}

.app-footer a:hover {
  color: #2563eb;
  text-decoration: underline;
}

/* ---- DARK MODE FIXES ---- */

body.dark {
  background: #0f172a;
  color: #e2e8f0;
}

body.dark .card {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark .table {
  color: #e2e8f0;
}

body.dark .table th {
  background: #1e293b;
  border-color: #334155;
}

body.dark .sidebar {
  background: #0b1120;
}

body.dark .form-control,
body.dark .form-select {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}

body.dark .form-control::placeholder,
body.dark .form-control:-ms-input-placeholder,
body.dark .form-control::-ms-input-placeholder {
  color: #94a3b8 !important;
  opacity: 1 !important;
}

body.dark .form-control:focus {
  background: #1e293b;
  border-color: #3b82f6;
  color: #e2e8f0;
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

body.dark .form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23e2e8f0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

body.dark .form-select option {
  background: #1e293b;
  color: #e2e8f0;
}

body.dark .input-group-text {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}

body.dark .totals-line {
  border-bottom-color: #334155;
}

body.dark .grand-total {
  border-bottom-color: #94a3b8;
}

body.dark #logoPreview {
  border-color: #475569;
}

body.dark .mobile-menu-btn {
  background: #3b82f6;
}

body.dark .mobile-menu-btn:hover {
  background: #2563eb;
}

body.dark .modal-content {
  background: #1e293b;
  color: #e2e8f0;
}

body.dark .modal-header {
  border-bottom-color: #334155;
}

body.dark .modal-footer {
  border-top-color: #334155;
}

body.dark .app-footer {
  background: #1e293b;
  border-top-color: #334155;
}

body.dark .app-footer a {
  color: #94a3b8;
}

body.dark .app-footer a:hover {
  color: #60a5fa;
}

/* ---- Mobile Responsive ---- */

@media (min-width: 768px) {
  .sidebar {
    left: 0;
    width: 220px;
    box-shadow: none;
  }

  .sidebar-close {
    display: none;
  }

  .sidebar-overlay {
    display: none !important;
  }

  .mobile-menu-btn {
    display: none;
  }

  .main-content {
    margin-left: 220px;
    padding: 1.25rem;
    padding-bottom: 1.25rem;
  }

  .page-title {
    font-size: 1.3rem;
  }

  .dashboard-card h4 {
    font-size: 1.2rem;
  }

  .dashboard-card h6 {
    font-size: 0.75rem;
  }
}

@media (min-width: 1200px) {
  .main-content {
    padding: 1.5rem;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .dashboard-card h4 {
    font-size: 1.4rem;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 0.5rem;
    padding-bottom: 70px;
  }

  .page-title {
    font-size: 0.95rem;
  }

  .card {
    border-radius: 10px;
  }

  .card .p-2 {
    padding: 0.5rem !important;
  }

  .card .p-3 {
    padding: 0.75rem !important;
  }

  .card .p-4 {
    padding: 0.75rem !important;
  }

  .table td,
  .table th {
    padding: 0.3rem 0.2rem;
    font-size: 0.7rem;
  }

  .btn {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
  }

  .form-control,
  .form-select {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    min-height: 28px;
  }

  .form-control-sm,
  .form-select-sm {
    font-size: 0.65rem;
    min-height: 26px;
  }

  .totals-card .totals-line span {
    font-size: 0.75rem;
  }

  .totals-card .grand-total {
    font-size: 0.95rem;
  }

  .badge {
    font-size: 0.6rem;
  }

  .mobile-menu-btn {
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
    bottom: 12px;
    right: 12px;
  }

  .sidebar {
    width: 260px;
    left: -260px;
  }

  .sidebar-brand {
    font-size: 1rem;
  }

  .sidebar .nav-link {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
  }

  .sidebar .nav-link i {
    font-size: 0.9rem;
  }

  .modal-body {
    padding: 0.5rem;
  }

  .modal-footer .btn {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
  }

  .date-filter-group {
    gap: 5px;
  }

  .date-filter-group input,
  .date-filter-group button {
    font-size: 0.65rem;
  }
}

@media (max-width: 360px) {
  .table td,
  .table th {
    padding: 0.2rem 0.1rem;
    font-size: 0.6rem;
  }

  .btn {
    font-size: 0.6rem;
    padding: 0.15rem 0.4rem;
  }

  .form-control,
  .form-select {
    font-size: 0.6rem;
    min-height: 24px;
  }

  .page-title {
    font-size: 0.85rem;
  }

  .totals-card .totals-line span {
    font-size: 0.65rem;
  }
}

/* Thermal print styles */
@media print {
  .thermal-print * {
    font-size: 12px;
  }
  .thermal-print .table td,
  .thermal-print .table th {
    padding: 4px;
  }
}