/* Main styles for Kamani Fish Farms - Mobile Responsive Version */

:root {
  --primary-color: #000080;
  --accent-color: #ffff00;
  --bg-color: #ffffff;
  --text-color: #333;
  --border-color: #ddd;
  --light-bg: #f4f4f4;
  --form-bg: #f8f9fa;
  --success-color: #4CAF50;
  --error-color: #f44336;
  --hover-bg: #e7e7e7;
  --shadow: 0 2px 5px rgba(0,0,0,0.1);
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-size: 16px;
}

.container {
  width: 95%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 10px;
}

/* Header and Navigation */
header {
  background: var(--primary-color);
  color: var(--accent-color);
  padding: 0.5rem;
  border-bottom: var(--accent-color) 3px solid;
  position: relative;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.logo-container {
  display: flex;
  align-items: center;
}

.logo {
  font-size: 1.3em;
  font-weight: bold;
  margin: 0;
  white-space: nowrap;
}

/* Mobile nav toggle */
.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--accent-color);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

.desktop-nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}

.desktop-nav ul li {
  padding: 0 10px;
}

.desktop-nav ul li a {
  color: #ffffff;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.9rem;
  display: block;
  padding: 0.5rem 0;
  transition: all 0.3s ease;
}

header .highlight, header .current a {
  color: var(--accent-color);
  font-weight: bold;
}

header a:hover {
  color: #ffffff;
  font-weight: bold;
}

main {
  flex-grow: 1;
  padding: 1rem 0;
}

footer {
  background: var(--primary-color);
  color: var(--accent-color);
  text-align: center;
  padding: 1rem 0;
  margin-top: auto;
  font-size: 0.9rem;
  position: relative;
  z-index: 10;
}

h1, h2, h3 {
  color: var(--primary-color);
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: 1.8rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.2rem;
}

/* Forms */
form {
  background: var(--light-bg);
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

form label {
  display: block;
  margin: 10px 0 5px;
  font-weight: 500;
}

form input[type="text"],
form input[type="number"],
form input[type="date"],
form input[type="tel"],
form input[type="password"],
form input[type="email"],
form select,
form textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 1rem;
  transition: border 0.3s ease;
}

form input:focus,
form select:focus,
form textarea:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 128, 0.1);
}

form button[type="submit"] {
  background-color: var(--primary-color);
  color: var(--accent-color);
  padding: 10px 15px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s ease;
}

form button[type="submit"]:hover {
  background-color: #000066;
}

/* Checkbox styling */
.checkbox-group {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.checkbox-group input[type="checkbox"] {
  margin-right: 10px;
}

.checkbox-group label {
  margin: 0;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border-radius: 4px;
  overflow: hidden;
}

.data-table th,
.data-table td {
  padding: 12px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
}

.data-table th {
  background-color: var(--primary-color);
  color: var(--accent-color);
  font-weight: 500;
  white-space: nowrap;
}

.data-table tr:nth-child(even) {
  background-color: var(--form-bg);
}

.data-table tr:hover {
  background-color: var(--hover-bg);
}

/* Table actions */
.data-table a {
  color: var(--primary-color);
  text-decoration: none;
  margin-right: 8px;
}

.data-table a:hover {
  text-decoration: underline;
}

/* Responsive tables for mobile */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
  border-radius: 4px;
  box-shadow: var(--shadow);
}

/* Flash messages */
.flash-message {
  padding: 12px;
  margin-bottom: 20px;
  border-radius: 4px;
  color: #fff;
  background-color: var(--success-color);
  box-shadow: var(--shadow);
}

.flash-message.error {
  background-color: var(--error-color);
}

/* Login page */
.login-container {
  max-width: 400px;
  margin: 50px auto;
  padding: 25px;
  background-color: var(--light-bg);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-container h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--primary-color);
}

/* Card styles */
.card {
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  margin-bottom: 20px;
  overflow: hidden;
}

.card-header {
  background-color: #f8f9fa;
  padding: 15px;
  border-bottom: 1px solid #e9ecef;
}

.card-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: #000080;
}

.card-body {
  padding: 15px;
}

.mt-4 {
  margin-top: 1.5rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 15px;
}

.submit-btn {
  background-color: #000080;
  color: #ffff00;
  border: none;
  padding: 10px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.3s;
}

.submit-btn:hover {
  background-color: #000066;
}

.btn-sm {
  padding: 5px 10px;
  margin-right: 5px;
  border-radius: 3px;
  font-size: 0.9rem;
  color: #fff;
  text-decoration: none;
  display: inline-block;
}

.edit-expense, .edit-sale, .edit-payment {
  background-color: #007bff;
  color: white;
}

.delete-confirm, .delete-sale {
  background-color: #dc3545;
  color: white;
}

/* Amount displays */
#total-amount-display,
#current-balance-display {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#total-amount-display .amount,
#current-balance-display .balance {
  font-size: 1.2rem;
  font-weight: bold;
  color: #28a745;
}

/* Notification styling */
.notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: 4px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 90%;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.notification.success {
  background-color: #28a745;
}

.notification.error {
  background-color: #dc3545;
}

#notification-message {
  margin-right: 15px;
  flex: 1;
}

#notification-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1rem;
}

/* Page header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* Form rows for compact layouts */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 15px;
}

.form-group {
  flex: 1 1 200px;
  min-width: 150px;
}

/* Export button */
.export-button, 
.export-form button {
  background-color: var(--primary-color);
  color: var(--accent-color);
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 10px;
  transition: background-color 0.3s ease;
}

.export-button:hover,
.export-form button:hover {
  background-color: #000066;
}

/* Enhanced pagination styling */
.pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin: 25px 0;
  gap: 8px;
}

.pagination a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  background-color: white;
  color: #000080;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
}

.pagination a.active {
  background-color: #000080;
  color: #ffff00;
  border-color: #000080;
}

.pagination a:hover:not(.active) {
  background-color: #f0f0f0;
  transform: translateY(-2px);
  box-shadow: 0 3px 5px rgba(0,0,0,0.1);
}

.pagination a i {
  font-size: 1rem;
}

.pagination-info {
  text-align: center;
  margin-top: 10px;
  color: #666;
  font-size: 0.9rem;
}

/* Dashboard summary boxes */
.dashboard-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 25px;
}

.summary-box {
  flex: 1 1 calc(33.333% - 15px);
  min-width: 240px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  padding: 20px;
  text-align: center;
  transition: transform 0.2s;
}

.summary-box:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.summary-box h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: #555;
  font-weight: 500;
}

.summary-box p {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #000080;
}

/* Data cards styling */
.data-card {
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 15px;
  overflow: hidden;
}

.data-card-header {
  background-color: #f8f9fa;
  padding: 15px;
  border-bottom: 1px solid #eee;
}

.data-card-header h2 {
  margin: 0;
  font-size: 18px;
  color: #000080;
}

.data-card-body {
  padding: 0;
}

/* Data items styling */
.data-row {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s;
}

.data-row:last-child {
  border-bottom: none;
}

.data-row:hover {
  background-color: #f8f9fa;
}

.data-label {
  flex: 1;
  padding: 12px 15px;
  font-weight: 500;
}

.data-value {
  flex: 1;
  padding: 12px 15px;
  text-align: right;
  font-weight: 500;
}

.data-value.bold {
  font-weight: 700;
  color: #000080;
}

/* Monthly data and buyer data tables */
.data-table-card {
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 25px;
  overflow: hidden;
}

.data-table-header {
  background-color: #000080;
  color: white;
  padding: 15px 20px;
  border-radius: 10px 10px 0 0;
}

.data-table-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: white;
}

/* Enhanced styling for monthly data cards */
.data-item {
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin: 0 0 16px 0;
  overflow: hidden;
}

.data-item-header {
  background-color: #f8f9fa;
  padding: 12px 16px;
  font-weight: 600;
  color: #000080;
  font-size: 18px;
  border-bottom: 1px solid #eee;
}

.data-item-body {
  padding: 0;
}

.data-item-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
}

.data-item-row:last-child {
  border-bottom: none;
}

.data-item-label {
  color: #555;
  font-weight: 500;
  font-size: 15px;
}

.data-item-value {
  font-weight: 600;
  color: #000080;
  font-size: 15px;
}

.data-item-row.highlight {
  background-color: rgba(0, 0, 128, 0.05);
}

.data-item-row.highlight .data-item-value {
  font-weight: 700;
  color: #000080;
}

/* Improved mobile menu - CRITICAL FIX */
.mobile-menu-wrapper {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 128, 0.97);
  z-index: 9999;
  overflow-y: auto;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.mobile-menu-wrapper.active {
  opacity: 1;
}

.mobile-menu {
  padding: 60px 20px 20px;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-menu-close {
  position: absolute;
  top: 15px;
  right: 15px;
  color: #ffff00;
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.mobile-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-menu-item {
  margin-bottom: 15px;
}

.mobile-menu-link {
  display: flex;
  align-items: center;
  padding: 15px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: white;
  text-decoration: none;
  font-size: 18px;
  transition: background-color 0.3s;
}

.mobile-menu-link:hover,
.mobile-menu-link.active {
  background-color: rgba(255, 255, 255, 0.2);
}

.mobile-menu-link i {
  margin-right: 15px;
  color: #ffff00;
  font-size: 22px;
  width: 25px;
  text-align: center;
}

.mobile-menu-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #000080;
  color: #ffff00;
  font-size: 24px;
  border: none;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  z-index: 9998;
}

/* MOBILE STYLES */
@media (max-width: 992px) {
  .summary-box {
    flex-basis: calc(50% - 15px);
  }
}

@media (max-width: 768px) {
  .container {
    width: 92%;
    padding: 0 10px;
  }
  
  /* Header responsive styles */
  .nav-toggle {
    display: block;
  }
  
  .desktop-nav {
    display: none;
  }
  
  /* Show the menu toggle in the header */
  .menu-toggle {
    display: flex;
    background: transparent;
    border: none;
    color: var(--accent-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
  }
  
  /* Show the mobile menu toggle */
  .mobile-menu-toggle {
    display: flex;
  }
  
  /* Table styles for mobile */
  .data-table {
    font-size: 0.85rem;
  }
  
  .data-table th, 
  .data-table td {
    padding: 8px 5px;
  }
  
  /* Forms on mobile */
  form {
    padding: 12px;
  }
  
  .form-group {
    flex: 1 1 100%;
  }
  
  /* Summary boxes on mobile */
  .summary-box {
    flex-basis: 100%;
  }
  
  .summary-box h3 {
    font-size: 15px;
  }
  
  .summary-box p {
    font-size: 22px;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  h2 {
    font-size: 1.3rem;
  }
  
  /* Adjust main content to account for bottom nav */
  main.container {
    padding-bottom: 70px;
  }
  
  /* Mobile responsive data-table */
  .data-table thead {
    display: none;
  }
  
  .data-table, 
  .data-table tbody, 
  .data-table tr {
    display: block;
    width: 100%;
  }
  
  .data-table tr {
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    background: white;
  }
  
  .data-table tr:nth-child(even) {
    background-color: #f8f9fa;
  }
  
  .data-table tr:hover {
    transform: translateY(-2px);
    transition: transform 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  }
  
  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    text-align: right;
  }
  
  .data-table td:last-child {
    border-bottom: none;
  }
  
  .data-table td::before {
    content: attr(data-label);
    font-weight: bold;
    flex: 1;
    text-align: left;
    margin-right: 10px;
    color: #666;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  .data-table td[data-label="Actions"] {
    justify-content: flex-start;
    padding: 8px 10px;
  }
  
  /* Enhanced action buttons */
  .data-table td[data-label="Actions"] a {
    padding: 10px 15px;
    margin: 0 5px;
    font-size: 1.1rem;
  }
  
  .btn-sm {
    padding: 12px 15px;
    min-width: 44px;
    border-radius: 5px;
    margin-right: 10px;
  }
  
  /* Amount styling */
  .amount-column {
    font-weight: bold;
    color: #000080;
  }
  
  .actions-column {
    display: flex !important;
    justify-content: flex-start !important;
  }
  
  .actions-column .btn-sm {
    flex: 0 0 auto;
    margin: 0 10px;
  }
  
  /* Export button improvements */
  .export-form {
    margin: 15px 0;
  }
  
  .export-form button {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 1rem;
  }
  
  /* Form improvements */
  input[type="date"], 
  input[type="number"],
  input[type="text"],
  select {
    height: 48px;
    font-size: 16px; /* Prevents iOS from zooming in */
  }
  
  /* Better pagination on mobile */
  .pagination {
    margin: 20px 0;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .pagination a {
    margin: 3px;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    font-size: 1rem;
  }
  
  .pagination a.active {
    background-color: #000080;
  }
  
  /* Form improvements */
  #sales-form .form-group,
  #expense-form .form-group,
  #payment-form .form-group {
    margin-bottom: 15px;
  }
  
  .checkbox-group label {
    padding: 10px 0;
    display: flex;
    align-items: center;
  }
  
  .checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
  }
  
  /* Dashboard data items for mobile */
  .data-table-card {
    margin-bottom: 20px;
  }
  
  .data-table-header h2 {
    font-size: 17px;
  }
  
  .data-item {
    margin: 10px;
  }
  
  .data-item-header {
    padding: 10px 12px;
    font-size: 16px;
  }
  
  .data-item-row {
    padding: 12px;
    font-size: 15px;
  }
  
  /* Notification adjustment */
  .notification {
    left: 20px;
    right: 20px;
    bottom: 80px; /* Position above bottom nav */
    max-width: calc(100% - 40px);
  }

  /* Responsive pagination adjustments */
  .pagination {
    gap: 6px;
  }
    
  .pagination a {
    min-width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
  
  /* Page header adjustments */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .export-button {
    width: 100%;
    text-align: center;
    justify-content: center;
    display: flex;
    align-items: center;
    padding: 12px;
  }
  
  .export-button i {
    margin-right: 8px;
  }
}

@media (max-width: 480px) {
  .container {
    width: 96%;
    padding: 0 5px;
  }
  
  .data-table th,
  .data-table td {
    padding: 6px 3px;
    font-size: 0.75rem;
  }
  
  form input[type="text"],
  form input[type="number"],
  form input[type="date"],
  form input[type="tel"],
  form input[type="password"],
  form select {
    padding: 8px;
  }
  
  .login-container {
    margin: 20px auto;
    padding: 15px;
  }
  
  /* Smaller mobile toggle button for very small screens */
  .mobile-menu-toggle {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }
  
  /* Adjust card padding for smaller screens */
  .card-header,
  .card-body {
    padding: 12px 10px;
  }
  
  /* Smaller summary boxes */
  .summary-box {
    padding: 15px 10px;
  }
  
  .summary-box p {
    font-size: 20px;
  }
}