/* =========================
   GLOBAL STYLES
   ========================= */
body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(135deg, #f4f6f8, #e0e7ff);
  margin: 0;
  padding: 20px;
  color: #333;
}

#syncStatusIndicator.offline {
  color: #dc2626; /* Red for offline */
}
#syncStatusIndicator.loading {
  color: #2563eb; /* Blue for loading/syncing */
}

/* =========================
   NAVIGATION
   ========================= */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  padding: 15px 5%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: #1e3a8a;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 25px;
  align-items: center;
}

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

.nav-links a:hover {
  color: #2563eb;
}

.nav-login-btn {
  background: #2563eb;
  color: #fff !important;
  padding: 8px 20px;
  border-radius: 6px;
}

/* =========================
   HERO SECTION
   ========================= */
#hero {
  height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(rgba(30, 58, 138, 0.8), rgba(30, 58, 138, 0.8)), url('https://images.unsplash.com/photo-1460925895917-afdab827c52f?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80');
  background-size: cover;
  background-position: center;
  color: white;
  padding: 0 20px;
}

.hero-content h1 { color: #fff; font-size: 3rem; margin-bottom: 20px; }
.hero-content p { font-size: 1.25rem; margin-bottom: 30px; opacity: 0.9; }

.cta-btn {
  background-color: #2563eb;
  color: #fff;
  padding: 15px 35px;
  font-size: 1.1rem;
  border-radius: 50px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background-color 0.3s ease, transform 0.2s ease;
  border: none;
}

.cta-btn:hover {
  background-color: #1e40af;
  color: #fff;
  transform: translateY(-2px);
}

h1, h2 {
  text-align: center;
  color: #1e3a8a;
}

/* =========================
   LOGIN FORM
   ========================= */
#authSection {
  max-width: 400px;
  margin: 60px auto;
  background: #fff;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  text-align: center;
}

#authSection h2 {
  margin-bottom: 20px;
  color: #2563eb;
}

#loginForm {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

#loginForm input {
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s;
}

#loginForm input:focus {
  border-color: #2563eb;
  outline: none;
  box-shadow: 0 0 6px rgba(37,99,235,0.3);
}

#loginForm button {
  padding: 12px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.3s;
}

#loginForm button:hover {
  background: #1e40af;
}

#forgotPasswordLink:hover {
  text-decoration: underline !important;
}

/* =========================
   LOGIN BUTTON SPINNER
   ========================= */
#loginBtn {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(37, 99, 235, 0.1);
  border-top: 3px solid #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

/* Override for white spinner on primary/action buttons */
#loginBtn .spinner, 
form button[type="submit"] .spinner, 
button.action-btn .spinner,
#saveItemBtn .spinner,
#registerOrderBtn .spinner,
#recordSaleBtn .spinner {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
}

.loading .spinner {
  display: inline-block;
}

#loginBtn.loading .spinner,
button.loading .spinner {
  display: inline-block;
}

#loginBtn.loading .btn-text,
button.loading .btn-text {
  opacity: 0.7;
}

#loginBtn:disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* =========================
   CONTAINER
   ========================= */
.container {
  max-width: 1000px;
  margin: auto;
  background: #fff;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* =========================
   TABS & ANALYTICS
   ========================= */
.tab-navigation {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 10px;
}

.tab-btn {
  padding: 11px 24px;
  border: 1px solid transparent;
  background: #f8fafc;
  font-weight: 700;
  color: #1f2937;
  cursor: pointer;
  border-radius: 10px;
  transition: transform 0.2s ease, background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 2px 6px rgba(15,23,42,0.08);
}

.tab-btn:hover {
  transform: translateY(-1px);
  background: #eff6ff;
}

.tab-btn[data-tab="inventory"] {
  background: #eef2ff;
  color: #4338ca;
}

.tab-btn[data-tab="orders"] {
  background: #ecfdf5;
  color: #047857;
}

.tab-btn[data-tab="sales"] {
  background: #fef3c7;
  color: #92400e;
}

.tab-btn.active {
  background: #2563eb;
  color: white;
  box-shadow: 0 12px 24px rgba(37,99,235,0.18);
}

.tab-btn[data-tab="inventory"].active {
  background: #4338ca;
}

.tab-btn[data-tab="orders"].active {
  background: #047857;
}

.tab-btn[data-tab="sales"].active {
  background: #92400e;
}

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

.stat-card {
  background: #f9fafb;
  padding: 20px;
  border-radius: 10px;
  border-left: 5px solid #2563eb;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stat-card h3 { font-size: 14px; color: #6b7280; margin: 0; }
.stat-card p { font-size: 24px; font-weight: bold; margin: 10px 0 0 0; color: #1e3a8a; }

/* =========================
   AUTOCOMPLETE SEARCH
   ========================= */
.search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  max-height: 250px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.search-result-item {
  padding: 10px 15px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  text-align: left;
  font-size: 14px;
}

.search-result-item:hover {
  background: #eff6ff;
  color: #2563eb;
}

.low-stock-list {
  display: grid;
  gap: 12px;
  margin-bottom: 25px;
}

.low-stock-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #f8fafc;
  color: #1f2937;
}

.low-stock-item strong {
  color: #b91c1c;
}

.payment-panel {
  margin-bottom: 30px;
}

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

.payment-card {
  padding: 18px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  background: #f8fafc;
}

.payment-card h3 {
  margin-bottom: 10px;
  color: #1e3a8a;
}

.payment-actions {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.payment-actions input {
  padding: 12px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
}

.payment-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.payment-buttons button {
  flex: 1;
  min-width: 180px;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 700;
  background: #2563eb;
  color: white;
  border-radius: 10px;
  border: none;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.16);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.payment-buttons button:hover {
  opacity: 0.96;
  transform: translateY(-1px);
}

.payment-buttons button#paymentAnnualBtn {
  background: #0ea5e9;
}

#openPaymentModalBtn {
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  background: #1d4ed8;
  color: white;
  border: none;
  box-shadow: 0 14px 32px rgba(29, 78, 216, 0.22);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

#openPaymentModalBtn:hover {
  background: #1e40af;
  transform: translateY(-1px);
}

#paymentModal .modal-content {
  max-width: 700px;
  width: 100%;
  padding: 30px;
  text-align: left;
}

#paymentModal .modal-content h2 {
  font-size: 24px;
  margin-bottom: 6px;
}

#paymentModal .modal-content p {
  font-size: 15px;
  color: #334155;
  margin-bottom: 16px;
}

#paymentModal .modal-content input {
  font-size: 16px;
}

.payment-receipt-item {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #fde68a;
  background: #fff7ed;
  color: #92400e;
}

.payment-receipt-item strong {
  color: #92400e;
}

.payment-info {
  margin: 0;
  line-height: 1.7;
}

/* =========================
   SECTION DIVIDER
   ========================= */
.section-divider {
  margin-top: 35px;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 3px solid #2563eb;
}

.section-divider h2 {
  margin: 0 0 10px 0;
  color: #1e3a8a;
  font-size: 22px;
}

/* =========================
   FORMS
   ========================= */
form {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

form input, form button {
  padding: 12px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
}

form input:focus {
  border-color: #059669;
  outline: none;
  box-shadow: 0 0 6px rgba(5,150,105,0.3);
}

form button {
  background: #2563eb;
  color: white;
  border: none;
  font-weight: bold;
  transition: background 0.3s;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

form button:hover {
  background: #1e40af;
}

/* =========================
   CONTROLS
   ========================= */
.controls {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.controls input {
  flex: 1;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
}

.controls button {
  padding: 12px 16px;
  background: #059669;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  transition: background 0.3s;
}

.controls button:hover {
  background: #047857;
}

/* =========================
   TABLE
   ========================= */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  border-radius: 8px;
  overflow: hidden;
}

table th, table td {
  border: 1px solid #e5e7eb;
  padding: 12px;
  text-align: center;
}

table th {
  background: #2563eb;
  color: white;
  font-weight: bold;
}

table tr:nth-child(even) {
  background: #f9fafb;
}

table tr:hover {
  background: #e0f2fe;
  transition: background 0.3s;
}

.low-stock-row {
  background-color: #fee2e2 !important;
  color: #991b1b;
}

/* =========================
   ACTION BUTTONS
   ========================= */
.action-btn, .actions button {
  margin: 0 4px;
  padding: 6px 10px;
  font-size: 13px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.3s;
  color: white; /* Ensure text is visible on dark button backgrounds */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-decoration: none;
}

/* =========================
   PAYMENT HISTORY MODAL TABLE
   ========================= */
.modal-table-wrapper {
  max-height: 400px;
  overflow-y: auto;
  margin-top: 15px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.payment-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.payment-history-table th {
  position: sticky;
  top: 0;
  background: #1e3a8a;
  z-index: 1;
}

.actions button:hover {
  opacity: 0.85;
}

.edit {
  background: #16a34a;
  color: white;
}

.delete {
  background: #dc2626;
  color: white;
}

/* =========================
   SUMMARY
   ========================= */
.summary {
  margin-top: 20px;
  font-size: 18px;
  text-align: right;
  color: #1e3a8a;
}

.summary span {
  font-weight: bold;
  color: #059669;
}

/* =========================
   LOGOUT BUTTON
   ========================= */
#logoutBtn, .logout-btn {
  background: #f59e0b;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s;
}

#logoutBtn:hover, .logout-btn:hover {
  background: #d97706;
}

/* =========================
   MODAL STYLES (Password Change)
   ========================= */
.modal {
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-y: auto;
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: #fff;
  padding: 40px 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  text-align: center;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from { transform: translateY(-30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-content h2 { margin-top: 0; color: #1e3a8a; }
.modal-content p { color: #6b7280; margin-bottom: 25px; font-size: 14px; }

.modal-content input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-sizing: border-box;
}

#changePasswordBtn {
  width: 100%;
  margin-bottom: 10px;
}

/* =========================
   ALERT MESSAGES
   ========================= */
.alert {
  padding: 12px 16px;
  margin: 15px auto;
  border-radius: 6px;
  font-size: 14px;
  max-width: 600px;
  text-align: center;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

.alert-info {
  background: #e0f2fe;
  color: #075985;
  border: 1px solid #0ea5e9;
}

/* =========================
   TOAST NOTIFICATIONS
   ========================= */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: 280px;
  animation: toastSlideIn 0.3s ease-out;
  transition: opacity 0.5s ease;
}

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* =========================
   RESPONSIVE DESIGN
   ========================= */

/* 📱 SMALL DEVICES (PHONES) */
@media (max-width: 600px) {

  body {
    padding: 10px;
  }

  h1, h2 {
    font-size: 20px;
  }

  /* Login */
  #authSection {
    margin: 30px 10px;
    padding: 20px;
  }

  /* Forms stack vertically */
  form {
    grid-template-columns: 1fr;
  }

  form input,
  form button {
    font-size: 14px;
  }

  /* Controls stack */
  .controls {
    flex-direction: column;
  }

  .controls button {
    width: 100%;
  }

  /* Table becomes scrollable */
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  table th,
  table td {
    font-size: 13px;
    padding: 8px;
  }

  /* Action buttons */
  .actions button {
    margin: 2px 0;
    display: block;
    width: 100%;
  }

  /* Summary */
  .summary {
    text-align: center;
    font-size: 16px;
  }

  #logoutBtn {
    width: 100%;
  }
}


/* 📲 MEDIUM DEVICES (TABLETS) */
@media (min-width: 601px) and (max-width: 900px) {

  form {
    grid-template-columns: repeat(2, 1fr);
  }

  .controls {
    flex-wrap: wrap;
  }

  .controls input {
    flex: 1 1 100%;
  }

  table th,
  table td {
    font-size: 14px;
  }

  .summary {
    font-size: 17px;
  }
}


/* 💻 SMALL LAPTOPS */
@media (min-width: 901px) and (max-width: 1200px) {

  form {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* =========================
   PROGRESS BAR
   ========================= */
.progress-container {
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  margin-bottom: 15px;
  overflow: hidden;
  display: none;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: #2563eb;
  transition: width 0.3s ease;
}

/* =========================
   PAGINATION
   ========================= */
.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  color: #1e3a8a;
  margin-top: 25px;
  padding: 15px;
  font-weight: 600;
}

.pagination-controls button {
  padding: 8px 20px;
  background-color: white;
  color: black;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s, transform 0.1s;
}

.pagination-controls button:hover:not(:disabled) {
  background-color: #1e40af;
  transform: translateY(-1px);
}

.pagination-controls button:disabled {
  background-color: #d1d5db !important;
  cursor: not-allowed;
  opacity: 0.6;
}

/* =========================
   ABOUT PAGE ENHANCEMENTS
   ========================= */
.about-container {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.about-paragraph {
  font-size: 1.15rem;
  line-height: 1.9;
  color: #4b5563;
  margin-bottom: 25px;
}

#about-mission {
  background: #f0f9ff;
  border-left: 5px solid #3b82f6;
  padding: 25px;
  border-radius: 0 15px 15px 0;
  text-align: left;
}

#about-vision {
  background: #f0fdf4;
  border-right: 5px solid #10b981;
  padding: 25px;
  border-radius: 15px 0 0 15px;
  text-align: right;
  font-style: italic;
}

.ceo-section {
  margin-top: 60px;
}

.ceo-card {
  background: #ffffff;
  padding: 35px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  border: 1px solid #f1f5f9;
  display: inline-block;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ceo-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.support-card {
  margin-top: 60px;
  padding: 40px;
  background: #f8fafc;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  transition: border-color 0.3s ease;
}

.support-card:hover {
  border-color: #2563eb;
}

/* =========================
   CONTACT PAGE ENHANCEMENTS
   ========================= */
.contact-body {
  background: #f3f4f6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 0;
}

.contact-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px; /* Added horizontal padding for smaller screens */
}

.contact-section {
  max-width: 650px; /* Slightly wider for more content */
  text-align: center;
  background: #ffffff; /* Card background */
  padding: 45px 35px;
  border-radius: 15px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  border: 1px solid #e0e7ff;
  animation: fadeIn 0.8s ease-out; /* Added a subtle fade-in animation */
}

.contact-heading {
  font-size: 2.8rem;
  margin-bottom: 15px;
  color: #1e3a8a;
  font-weight: 700;
}

.contact-intro-text {
  font-size: 1.1rem;
  color: #6b7280;
  margin-bottom: 30px;
  line-height: 1.7;
}

.contact-info-card {
  background: #f8fafc;
  padding: 30px;
  border-radius: 12px;
  border: 1px dashed #d1d5db; /* Dashed border for a friendly look */
  margin-bottom: 30px;
}

.contact-detail {
  font-size: 1.25rem;
  margin-bottom: 15px; /* Spacing between contact details */
  color: #333;
}

.contact-detail:last-child {
  margin-bottom: 0;
}

.contact-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s, text-decoration 0.3s;
}

.contact-link:hover {
  color: #1e40af;
  text-decoration: underline;
}

.contact-link.whatsapp {
  color: #25d366; /* WhatsApp green */
}

.contact-link.whatsapp:hover {
  color: #1da851; /* Darker green on hover */
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================
   FOOTER STYLES
   ========================= */
.main-footer {
  background-color: #ffffff;
  padding: 30px 0;
  margin-top: 50px;
  border-top: 1px solid #e5e7eb;
  text-align: center;
}

.footer-text {
  color: #6b7280;
  font-size: 0.95rem;
  font-weight: 400;
}

.footer-links {
  margin-top: 10px;
}

.footer-links a {
  color: #6b7280;
  text-decoration: none;
  font-size: 0.85rem;
  margin: 0 8px;
  transition: color 0.3s;
}

.footer-links a:hover {
  color: #2563eb;
}

/* =========================
   COOKIE CONSENT BANNER
   ========================= */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1e3a8a;
  color: white;
  padding: 15px 5%;
  display: none; /* Controlled by JS */
  justify-content: space-between;
  align-items: center;
  z-index: 3000;
  box-shadow: 0 -2px 15px rgba(0,0,0,0.2);
  font-size: 0.9rem;
  transition: opacity 0.5s ease;
}

.cookie-banner a { color: #fff; text-decoration: underline; }

.cookie-banner.fade-out {
  opacity: 0;
}

.cookie-btn {
  background: #fff;
  color: #1e3a8a;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  margin-left: 20px;
  white-space: nowrap;
}
