/**
 * MonsterAgro Main Stylesheet
 * 
 * This file contains all global styles for the MonsterAgro application,
 * including styles for the crop species and breeds statistics page.
 * 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
 * - Species card styles (razas_stat)
 * - Breed item styles (razas_stat)
 * - Breed statistics display styles (razas_stat)
 * - Empty state styles (razas_stat)
 * - 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;
}

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

/* Species card container - white box for each species */
.species-card {
  background: white;
  border-radius: 10px;
  margin-bottom: 15px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Species header - clickable section to expand/collapse breeds */
.species-header {
  padding: 20px;
  cursor: pointer; /* Indicates this is clickable */
  /* Green gradient background for visual appeal */
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border-radius: 10px 10px 0 0; /* Rounded top corners only */
  transition: all 0.3s; /* Smooth animation on hover */
}

/* Species header hover state - darker green gradient */
.species-header:hover {
  background: linear-gradient(135deg, #218838 0%, #1aa179 100%);
}

/* Species header title - flex layout for title and icon alignment */
.species-header h4 {
  margin: 0;
  display: flex;
  justify-content: space-between; /* Title on left, icon on right */
  align-items: center;
}

/* ============================================
   BREED ITEM STYLES
   ============================================ */

/* Individual breed item within species card */
.breed-item {
  padding: 15px 20px;
  border-bottom: 1px solid #e9ecef; /* Separator between breeds */
  cursor: pointer;
  transition: background 0.2s; /* Smooth background change on hover */
}

/* Breed item hover state - light gray background */
.breed-item:hover {
  background: #f8f9fa;
}

/* Remove border from last breed item */
.breed-item:last-child {
  border-bottom: none;
}

/* Breed name - green text, bold for emphasis */
.breed-name {
  font-weight: 600;
  color: #28a745;
  margin-bottom: 5px;
}

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

/* Statistics container - hidden by default, shown on breed selection */
.breed-stats {
  display: none; /* Hidden until breed is selected */
  margin-top: 15px;
  padding: 15px;
  background: #f8f9fa; /* Light gray background */
  border-radius: 5px;
}

/* Show class - applied when breed stats should be visible */
.breed-stats.show {
  display: block;
}

/* Individual stat row - displays label and value */
.stat-item {
  display: flex;
  justify-content: space-between; /* Label on left, value on right */
  padding: 8px 0;
  border-bottom: 1px solid #dee2e6;
}

/* Remove border from last stat item */
.stat-item:last-child {
  border-bottom: none;
}

/* Stat label - gray text for descriptive labels */
.stat-label {
  font-weight: 500;
  color: #6c757d;
}

/* Stat value - green text for actual values */
.stat-value {
  font-weight: 600;
  color: #28a745;
}

/* ============================================
   EMPTY STATE STYLES
   ============================================ */

/* No data message - centered gray text when no species exist */
.no-data {
  text-align: center;
  padding: 40px;
  color: #6c757d;
}

/* ============================================
   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;
  }

  /* Species card adjustments */
  .species-header {
    padding: 15px;
  }

  .breed-item {
    padding: 12px 15px;
  }

  /* 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;
  }

  /* Species card adjustments */
  .species-header {
    padding: 12px;
  }

  .species-header h4 {
    font-size: 14px;
  }

  .breed-item {
    padding: 10px 12px;
  }

  .breed-name {
    font-size: 12px;
  }

  .breed-stats {
    padding: 10px;
  }

  .stat-item {
    padding: 6px 0;
    font-size: 11px;
  }

  /* 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;
  }
}