@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");

:root {
  --primary-color: #3396d3;
  --secondary-color: #2563eb;
  --white-color: #fff;
  --dark-color: #0f0e0e;
  --text-color: #44444e;
  --green-color: rgb(0, 128, 0);
  --warning-color: #faa533;
  --red-color: red;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  list-style: none;
  text-decoration: none;
}

body {
  font-family: "Montserrat", serif;
}

html {
  scroll-behavior: smooth;
}

img {
  max-width: 100%;
}

p {
  line-height: 1.5;
}

p,
a {
  font-size: 1rem;
}

.wrapper {
  position: relative;
}

.container {
  max-width: 90%;
  margin: 2rem auto;
  padding: 1rem;
}

.container-fluid {
  max-width: 100%;
  padding: 2rem 5%;
}

@media screen and (min-width: 768px) {
  p,
  a {
    font-size: 1.7rem;
  }
}

@media screen and (min-width: 888px) {
  p,
  a {
    font-size: 1rem;
  }
}

.toast-box,
.alert-box {
  position: fixed;
  width: 300px;
  pointer-events: none;
  top: 10vh;
  height: 300px;
  right: 5%;
  z-index: 9999;
}

.toast,
.alert {
  background-color: var(--white-color);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 600;
  padding: 10px;
  margin: 10px 0;
  border-radius: 10px;
}

.toast-success,
.alert-success {
  color: var(--green-color);
}

.toast-warning,
.alert-warning {
  color: var(--warning-color);
}

.toast-error,
.alert-error {
  color: var(--red-color);
}

@media screen and (min-width: 888px) {
  .toast-box {
    width: 400px;
  }
}

/* Auth Page Layout */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #f9f9f9;
}

.auth-card {
  background: var(--white-color);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 400px;
}

.card-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.card-logo img {
  max-width: 150px;
  display: block;
}

.card-header img {
  max-width: 80px;
  display: block;
}

.auth-title {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-color);
}

/* Form Fields */
.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  color: var(--text-color);
}

.form-group input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border 0.2s ease-in-out;
}

.form-group input:focus {
  border-color: var(--primary-color);
}

.form-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-color);
  background-color: var(--white-color);
  outline: none;
  transition: border-color 0.3s ease;
}

.form-group select:focus {
  border-color: var(--primary-color);
}

/* Buttons */
.btn-primary {
  display: inline-block;
  width: auto;
  padding: 0.9rem;
  background: var(--primary-color);
  color: var(--white-color);
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease-in-out;
}

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

.btn-secondary {
  background: var(--secondary-color);
  color: var(--white-color);
  display: inline-block;
  width: auto;
  padding: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease-in-out;
}

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

/* Switch Link */
.auth-switch {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.9rem;
}

.auth-switch a {
  color: var(--brand-color);
  font-weight: 500;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* Footer */
.footer {
  background: var(--dark-color);
  color: var(--white-color);
  text-align: center;
  padding: 1rem;
  margin-top: 2rem;
}

/* ===== Navbar ===== */
.navbar {
  background: #ffffff;
  border-bottom: 1px solid #ddd;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  font-size: 1.25rem;
  font-weight: bold;
  color: #333;
  text-decoration: none;
}

.nav-logo img {
  width: 150px;
  margin-right: 8px;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

.nav-links li a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  transition: color 0.3s;
}

.nav-links li a:hover {
  color: #007bff;
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-auth a {
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}

.btn-login {
  color: #007bff;
}

.btn-register {
  padding: 6px 12px;
  background: #007bff;
  color: #fff;
  border-radius: 4px;
}

.btn-logout {
  padding: 6px 12px;
  background: #dc3545;
  color: var(--white-color);
  border-radius: 4px;
}

.username {
  font-size: 0.9rem;
  color: var(--text-color);
}

/* Profile dropdown */
.nav-profile {
  position: relative;
}

.profile-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.8rem;
  color: var(--primary-color);
}

.dropdown {
  position: absolute;
  top: 110%;
  right: 0;
  background: var(--white-color);
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  list-style: none;
  padding: 0.5rem 0;
  min-width: 160px;
  display: none;
  z-index: 100;
}

.dropdown li {
  padding: 0;
}

.dropdown li a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text-color);
  text-decoration: none;
  transition: background 0.2s ease;
}

.dropdown li a:hover {
  background: var(--secondary-color);
  color: var(--white-color);
}

/* Desktop hover */
.nav-profile:hover .dropdown {
  display: block;
}

/* ===== Mobile Navbar ===== */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

@media (max-width: 850px) {
  .nav-links {
    position: absolute;
    top: 60px;
    right: 0;
    background: #fff;
    width: 200px;
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
    display: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  }

  .nav-links.active {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }
}

.dashboard-container {
  padding: 20px;
}

.dashboard-title {
  font-size: 24px;
  margin-bottom: 20px;
  font-weight: bold;
}

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

.dashboard-card {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.dashboard-card h3 {
  font-size: 16px;
  margin-bottom: 10px;
  color: #555;
}

.dashboard-number {
  font-size: 22px;
  font-weight: bold;
  color: #333;
}

.dashboard-section {
  margin-top: 30px;
}

.dashboard-section h2 {
  font-size: 18px;
  margin-bottom: 15px;
}

.activity-list {
  list-style: none;
  padding: 0;
}

.activity-list li {
  background: #f9f9f9;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 5px;
  font-size: 14px;
}

.quick-actions {
  margin: 30px 0;
}

.quick-actions h2 {
  font-size: 1.2rem;
  margin-bottom: 15px;
  color: #333;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 15px;
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 8px;
  text-decoration: none;
  color: #333;
  transition: background 0.3s ease;
}

.action-card:hover {
  background: #eaeaea;
}

.action-card .icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

/* Overlay */
.modal {
  display: none;
  justify-content: center;
  align-items: flex-start;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  padding-top: 60px;
  overflow-y: auto;
}

/* Modal content */
.modal-content {
  background: #fff;
  padding: 2rem;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

/* Close button */
.close-modal {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
  background-color: var(--white-color);
}

/* Form inside modal */
.modal-content .form-group {
  margin-bottom: 15px;
}

.modal-content label {
  display: block;
  font-weight: 500;
  margin-bottom: 5px;
}

.modal-content input,
.modal-content textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 5px;
  border: 1px solid #ccc;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1rem;
}

#productMovementTitle {
  margin-top: 2rem;
}

@media screen and (max-width: 600px) {
  .page-header {
    flex-direction: column;
  }
}

.business-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.business-card,
.active-business-card {
  background: var(--white-color);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.business-logo-container {
  width: 150px;
}

.business-logo {
  width: 100%;
  object-fit: cover;
  margin-bottom: 10px;
}

.card-header h3 {
  margin: 0.5rem 0 0;
}

.card-body p {
  margin: 0.3rem 0;
}

.card-footer {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

.btn-danger {
  background: red;
  color: var(--white-color);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
}

.hidden {
  display: none;
}

.modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: space-around;
}

#invoiceForm {
  display: grid;
  gap: 1rem;
}

.modal-section {
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.08);
  padding: 10px;
}

.modal-title {
  margin-bottom: 1rem;
}

.section-title {
  margin-bottom: 0.5rem;
}

.invoice-discount {
  margin-top: 1rem;
}

/* Form layouts */
.form-grid-2 {
  display: grid;
  gap: 1rem;
}
@media (min-width: 720px) {
  .form-grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.summary-grid {
  display: grid;
  gap: 0.5rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 0.65rem 0.75rem;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
}

.invoice-item-number {
  display: flex;
  justify-content: space-between;
  width: 100%;
  align-items: center;
  margin-bottom: 0.5rem;
}

.delete-invoice-item {
  color: red;
  cursor: pointer;
  border: 0;
  font-size: 1.2rem;
}

.table-wrapper {
  margin-top: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.styled-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.styled-table th,
.styled-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}

.styled-table th {
  background: #f9fafb;
  font-weight: 600;
  font-size: 14px;
}

.styled-table td {
  font-size: 14px;
}

.styled-table .actions button {
  margin-right: 6px;
  font-size: 13px;
  padding: 6px 10px;
}

.status {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.status.paid {
  background: #e6ffed;
  color: #057a3a;
}

.status.pending {
  background: #fff3cd;
  color: #856404;
}

.status.overdue {
  background: #fdecea;
  color: #b71c1c;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-filter {
  display: flex;
  gap: 8px;
}

.search-filter input,
.search-filter select {
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
.tab-link {
  padding: 10px 20px;
  border: none;
  background: #f1f1f1;
  cursor: pointer;
  border-radius: 6px;
}
.tab-link.active {
  background: #007bff;
  color: #fff;
}
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

.active-business-card {
  position: sticky;
  top: 6vh;
}

#businessSwitcher {
  padding: 6px 10px;
  border: 1px solid var(--primary-color);
  border-radius: 6px;
  font-size: 14px;
  background: #f9fafb;
  color: var(--green-color);
  cursor: pointer;
  transition: border-color 0.2s;
}

#businessSwitcher:hover {
  border-color: var(--green-color);
}

/* Container */
.invoice-container {
  background: #fff;
  padding: 30px;
  margin: 20px auto;
  border: 1px solid #eee;
  border-radius: 8px;
  max-width: 900px;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: #333;
}

/* Invoice Header */
.invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.business-info {
  max-width: 50%;
}

.invoice-meta p {
  margin: 4px 0;
  text-align: right;
}

/* Customer Info */
.customer-info {
  margin-bottom: 20px;
  padding: 10px;
  border: 1px solid #eee;
  border-radius: 6px;
  background: #fafafa;
}

/* Totals Section */
.invoice-summary {
  text-align: right;
  margin-top: 20px;
}

.invoice-summary p {
  margin: 4px 0;
}

.invoice-summary strong {
  font-size: 1.1em;
}

/* Payment History */
.payment-history h4 {
  margin-bottom: 10px;
}

/* Receipt metadata section */
.receipt-meta {
  text-align: right;
  font-size: 0.9rem;
  color: #333;
}

.receipt-meta p {
  margin: 4px 0;
}

.notes-section {
  margin-top: 20px;
  padding: 15px;
  background: #fafafa;
  border-left: 4px solid #007bff;
  border-radius: 6px;
}

#invoiceDownloadArea,
#receiptDownloadArea {
  max-width: 800px;
  margin: auto;
  background: #fff;
  padding: 20px;
}
