/**
 * MonsterAgro Main Stylesheet
 * 
 * This file contains all global styles for the MonsterAgro application.
 * Color scheme: Green (#28a745) for primary actions, Purple (#667eea) for secondary
 * Background: Wheat color (#F5DEB3) for consistent page appearance
 * 
 * Sections:
 * - Global body styles
 * - Button styles (custom, delete)
 * - Table styles (containers, headers, rows)
 * - Form styles (containers, labels, controls)
 * - Card styles (custom cards with hover effects)
 * - Navigation styles (navbar, branding)
 * - Login page styles
 * - Statistics display styles
 * - Edit farm form styles
 * - Alert/notification styles
 * - Responsive design rules
 */

/* ============================================
   GLOBAL BODY STYLES
   ============================================ */

body {
  font-family: Arial, sans-serif;
  /* Wheat background color applied to all pages for consistency */
  background-color: #F5DEB3;
}

/* ============================================
   BUTTON STYLES
   ============================================ */

/* Primary custom button - used for add/save actions */
.btn-custom {
  background-color: #28a745; /* Green */
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
}

/* Hover state for primary button - darker green */
.btn-custom:hover {
  background-color: #218838;
  color: white;
}

/* Delete button - red for destructive actions */
.btn-delete {
  background-color: #dc3545; /* Red */
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
}

/* Hover state for delete button - darker red */
.btn-delete:hover {
  background-color: #c82333;
}

/* ============================================
   TABLE STYLES
   ============================================ */

/* Container for tables - white background with shadow for depth */
.table-container {
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* Main table element - full width */
.degv_tabula {
  width: 100%;
}

/* Table header row - green background with white text */
.tabulas_galva {
  background-color: #28a745;
  color: white;
  padding: 12px;
  text-align: left;
}

/* Table data rows - light borders for separation */
.tabulas_ieraksts {
  padding: 10px;
  border-bottom: 1px solid #dee2e6;
}

/* ============================================
   FORM STYLES
   ============================================ */

/* Form container - white box with shadow */
.form-container {
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* ============================================
   CARD STYLES
   ============================================ */

/* Custom card component - used for content blocks */
.card-custom {
  border: none;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  transition: transform 0.2s; /* Smooth animation on hover */
}

/* Card hover effect - lifts card up slightly */
.card-custom:hover {
  transform: translateY(-5px);
}

/* ============================================
   NAVIGATION STYLES
   ============================================ */

/* Navigation bar - subtle shadow for separation */
.navbar {
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Logo image in navbar - fixed height */
.navbar-brand img {
  height: 50px;
}

/* ============================================
   LOGIN PAGE STYLES
   ============================================ */

/* Login form container - centered on page */
.login-container {
  max-width: 400px;
  margin: 100px auto; /* Center vertically and horizontally */
  background: white;
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* Login header section */
.login-header {
  text-align: center;
  margin-bottom: 30px;
}

/* Login title - green color matching brand */
.login-header h2 {
  color: #28a745;
}

/* ============================================
   STATISTICS DISPLAY STYLES
   ============================================ */

/* Stat box - used for displaying key metrics */
.stat-box {
  /* Purple gradient background for visual appeal */
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Stat box label - smaller text above the number */
.stat-box h6 {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-bottom: 10px;
}

/* Stat box value - large prominent number */
.stat-box h3 {
  font-size: 2rem;
  font-weight: bold;
  margin: 0;
}

/* ============================================
   EDIT FARM FORM STYLES
   ============================================ */

/* Edit farm form container */
.edit-farm-form {
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(0,0,0,0.1);
}

/* Form label styling */
.form-label {
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

/* Form input focus state - purple border and shadow */
.form-control:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Primary button - purple for secondary actions */
.btn-primary {
  background-color: #667eea;
  border-color: #667eea;
}

/* Primary button hover - darker purple */
.btn-primary:hover {
  background-color: #5568d3;
  border-color: #5568d3;
}

/* Secondary button - gray for less important actions */
.btn-secondary {
  background-color: #6c757d;
  border-color: #6c757d;
}

/* Secondary button hover - darker gray */
.btn-secondary:hover {
  background-color: #5a6268;
  border-color: #545b62;
}

/* ============================================
   ALERT/NOTIFICATION STYLES
   ============================================ */

/* Info alert - light blue background */
.alert-info {
  background-color: #d1ecf1;
  border-color: #bee5eb;
  color: #0c5460;
}

/* Danger alert - light red background for errors */
.alert-danger {
  background-color: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

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

/* General responsive improvements */
@media (max-width: 1024px) {
  /* Improve touch targets - minimum 44px for mobile */
  button,
  .btn,
  a.btn,
  input[type="button"],
  input[type="submit"] {
    min-height: 44px;
    min-width: 44px;
  }

  /* Improve spacing between interactive elements */
  .btn + .btn {
    margin-left: 5px;
  }
}

/* Tablet devices (768px and below) */
@media (max-width: 768px) {
  /* Body adjustments */
  body {
    font-size: 14px;
  }

  /* Navigation bar adjustments */
  .navbar {
    padding: 0.5rem 1rem;
  }

  .navbar-brand img {
    height: 40px;
  }

  /* Button adjustments - smaller padding on mobile */
  .btn-custom,
  .btn-delete,
  .btn,
  .btn-sm {
    padding: 8px 12px;
    font-size: 13px;
    min-height: 40px;
  }

  /* Ensure touch targets are at least 44px */
  button,
  .btn,
  a.btn {
    min-height: 44px;
  }

  /* Table adjustments - horizontal scroll for mobile */
  .table-container {
    overflow-x: auto;
    padding: 15px;
    -webkit-overflow-scrolling: touch;
  }

  .degv_tabula {
    font-size: 12px;
  }

  .tabulas_galva {
    padding: 8px;
    font-size: 12px;
  }

  .tabulas_ieraksts {
    padding: 8px;
    font-size: 12px;
  }

  /* Form adjustments */
  .form-container,
  .edit-farm-form {
    padding: 20px;
  }

  .form-label {
    font-size: 13px;
  }

  .form-control,
  .form-select {
    font-size: 14px;
    padding: 8px;
    min-height: 40px;
  }

  /* Login container adjustments */
  .login-container {
    max-width: 90%;
    margin: 50px auto;
    padding: 25px;
  }

  .login-header h2 {
    font-size: 24px;
  }

  /* Card adjustments */
  .card-custom {
    margin-bottom: 15px;
  }

  /* Stat box adjustments */
  .stat-box {
    padding: 15px;
    margin-bottom: 10px;
  }

  .stat-box h3 {
    font-size: 1.5rem;
  }

  .stat-box h6 {
    font-size: 0.8rem;
  }

  /* Modal adjustments */
  .modal-dialog {
    margin: 10px;
  }

  .modal-content {
    border-radius: 8px;
  }

  /* Container adjustments */
  .container,
  .container-fluid {
    padding: 10px;
  }

  /* Row and column adjustments */
  .row {
    margin-right: -10px;
    margin-left: -10px;
  }

  .col,
  [class*="col-"] {
    padding-right: 10px;
    padding-left: 10px;
  }

  /* Accordion adjustments */
  .accordion-button {
    padding: 10px 15px;
    font-size: 13px;
    min-height: 44px;
  }

  /* Alert adjustments */
  .alert {
    padding: 10px 15px;
    font-size: 12px;
    margin-bottom: 10px;
  }

  /* Header container */
  #header-container {
    margin-bottom: 15px;
  }

  /* Checkbox and radio adjustments */
  input[type="checkbox"],
  input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
  }

  /* Select dropdown adjustments */
  select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
  }
}

/* Small mobile devices (480px and below) */
@media (max-width: 480px) {
  /* Body adjustments */
  body {
    font-size: 12px;
  }

  /* Navigation bar - stack items */
  .navbar {
    padding: 0.5rem 0.5rem;
  }

  .navbar-brand img {
    height: 35px;
  }

  .navbar-brand {
    font-size: 14px;
  }

  /* Button adjustments - very small on mobile */
  .btn-custom,
  .btn-delete,
  .btn,
  .btn-sm {
    padding: 6px 10px;
    font-size: 11px;
    width: 100%;
    margin-bottom: 5px;
    min-height: 44px;
  }

  /* Ensure touch targets are at least 44px */
  button,
  .btn,
  a.btn {
    min-height: 44px;
    display: block;
    width: 100%;
  }

  /* Table adjustments - stack columns on very small screens */
  .table-container {
    overflow-x: auto;
    padding: 10px;
    -webkit-overflow-scrolling: touch;
  }

  .degv_tabula {
    font-size: 10px;
  }

  .tabulas_galva {
    padding: 6px;
    font-size: 10px;
  }

  .tabulas_ieraksts {
    padding: 6px;
    font-size: 10px;
  }

  /* Form adjustments */
  .form-container,
  .edit-farm-form {
    padding: 15px;
  }

  .form-label {
    font-size: 12px;
    margin-bottom: 5px;
  }

  .form-control,
  .form-select {
    font-size: 12px;
    padding: 6px;
    min-height: 40px;
  }

  /* Login container adjustments */
  .login-container {
    max-width: 95%;
    margin: 30px auto;
    padding: 20px;
  }

  .login-header h2 {
    font-size: 20px;
    margin-bottom: 20px;
  }

  .login-header {
    margin-bottom: 20px;
  }

  /* Card adjustments */
  .card-custom {
    margin-bottom: 10px;
  }

  /* Stat box adjustments */
  .stat-box {
    padding: 12px;
    margin-bottom: 8px;
  }

  .stat-box h3 {
    font-size: 1.2rem;
  }

  .stat-box h6 {
    font-size: 0.75rem;
  }

  /* Modal adjustments */
  .modal-dialog {
    margin: 5px;
    max-width: 95%;
  }

  .modal-header {
    padding: 10px 15px;
  }

  .modal-body {
    padding: 15px;
  }

  .modal-footer {
    padding: 10px 15px;
  }

  /* Container adjustments */
  .container,
  .container-fluid {
    padding: 5px;
  }

  /* Row and column adjustments */
  .row {
    margin-right: -5px;
    margin-left: -5px;
  }

  .col,
  [class*="col-"] {
    padding-right: 5px;
    padding-left: 5px;
  }

  /* Accordion adjustments */
  .accordion-button {
    padding: 8px 12px;
    font-size: 11px;
    min-height: 44px;
  }

  .accordion-button:not(.collapsed) {
    background-color: #e7f3ff;
  }

  /* Alert adjustments */
  .alert {
    padding: 8px 12px;
    font-size: 11px;
    margin-bottom: 8px;
  }

  /* Table responsive - hide less important columns */
  .table-responsive {
    font-size: 11px;
  }

  /* Header container */
  #header-container {
    margin-bottom: 10px;
  }

  /* Breadcrumb adjustments */
  .breadcrumb {
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    font-size: 11px;
  }

  /* Badge adjustments */
  .badge {
    padding: 4px 8px;
    font-size: 10px;
  }

  /* Input group adjustments */
  .input-group {
    margin-bottom: 10px;
  }

  .input-group-text {
    padding: 6px 10px;
    font-size: 11px;
  }

  /* Checkbox and radio adjustments */
  input[type="checkbox"],
  input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-right: 8px;
  }

  /* Select dropdown adjustments */
  select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
  }

  /* Stack buttons vertically on small screens */
  .btn-group,
  .btn-toolbar {
    display: flex;
    flex-direction: column;
  }

  .btn-group > .btn,
  .btn-toolbar > .btn {
    width: 100%;
    margin-bottom: 5px;
  }
}
