/* APRA Cattle Co. Admin Dashboard Styles */

:root {
  --admin-primary: #3d2817;
  --admin-secondary: #8b6f47;
  --admin-accent: #2563eb;
  --admin-success: #10b981;
  --admin-warning: #f59e0b;
  --admin-danger: #ef4444;
  --admin-bg: #f3f4f6;
  --admin-card-bg: #ffffff;
  --admin-text: #1f2937;
  --admin-text-light: #6b7280;
  --admin-border: #e5e7eb;
  --admin-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  --admin-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ===== LOGIN PAGE ===== */
.admin-login-body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--admin-primary) 0%, var(--admin-secondary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 12px;
  box-shadow: var(--admin-shadow-lg);
  overflow: hidden;
}

.login-header {
  background: var(--admin-primary);
  color: white;
  padding: 40px 30px;
  text-align: center;
}

.login-header h1 {
  margin: 0 0 10px 0;
  font-size: 2rem;
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 2px;
}

.login-header p {
  margin: 0;
  font-size: 1rem;
  opacity: 0.9;
}

.login-form {
  padding: 30px;
}

.login-form .form-group {
  margin-bottom: 20px;
}

.login-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--admin-text);
  font-size: 0.9rem;
}

.login-form input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--admin-border);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s;
}

.login-form input:focus {
  outline: none;
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-login {
  width: 100%;
  padding: 14px;
  background: var(--admin-accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 10px;
}

.btn-login:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.error-message {
  padding: 12px;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: var(--admin-danger);
  font-size: 0.9rem;
  margin-bottom: 15px;
}

.login-footer {
  padding: 20px 30px;
  text-align: center;
  border-top: 1px solid var(--admin-border);
}

.login-footer a {
  color: var(--admin-accent);
  text-decoration: none;
  font-weight: 500;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* ===== ADMIN DASHBOARD LAYOUT ===== */
.admin-body {
  margin: 0;
  padding: 0;
  background: var(--admin-bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--admin-text);
}

.admin-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background: var(--admin-primary);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  left: 0;
  top: 0;
}

.admin-sidebar-header {
  padding: 30px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar-header h1 {
  margin: 0 0 5px 0;
  font-size: 1.5rem;
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 2px;
}

.admin-sidebar-header p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.7;
}

.admin-nav {
  flex: 1;
  padding: 20px 0;
}

.admin-nav-item {
  display: block;
  padding: 14px 24px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  font-size: 0.95rem;
}

.admin-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.admin-nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  border-left-color: var(--admin-accent);
  color: white;
  font-weight: 600;
}

.admin-sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-logout {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Main Content */
.admin-main {
  flex: 1;
  margin-left: 260px;
  padding: 30px;
}

.admin-header {
  margin-bottom: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-header h1 {
  margin: 0;
  font-size: 2rem;
  color: var(--admin-text);
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 1px;
}

.admin-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--admin-text-light);
  font-size: 0.9rem;
}

/* Cards */
.admin-card {
  background: var(--admin-card-bg);
  border-radius: 10px;
  box-shadow: var(--admin-shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.admin-card-header {
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--admin-text);
  margin: 0;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--admin-card-bg);
  border-radius: 10px;
  padding: 24px;
  box-shadow: var(--admin-shadow);
  border-left: 4px solid var(--admin-accent);
}

.stat-card.success {
  border-left-color: var(--admin-success);
}

.stat-card.warning {
  border-left-color: var(--admin-warning);
}

.stat-card.danger {
  border-left-color: var(--admin-danger);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--admin-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--admin-text);
  margin: 0;
}

.stat-change {
  font-size: 0.85rem;
  margin-top: 8px;
  color: var(--admin-success);
}

.stat-change.negative {
  color: var(--admin-danger);
}

/* Tables */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
}

.admin-table thead {
  background: var(--admin-bg);
}

.admin-table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--admin-text);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-table td {
  padding: 16px;
  border-top: 1px solid var(--admin-border);
}

.admin-table tbody tr:hover {
  background: var(--admin-bg);
}

/* Buttons */
.btn-primary {
  padding: 10px 20px;
  background: var(--admin-accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

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

.btn-success {
  padding: 8px 16px;
  background: var(--admin-success);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.btn-success:hover {
  background: #059669;
}

.btn-warning {
  padding: 8px 16px;
  background: var(--admin-warning);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.btn-danger {
  padding: 8px 16px;
  background: var(--admin-danger);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

/* Form Elements */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.form-group-admin {
  margin-bottom: 20px;
}

.form-group-admin label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--admin-text);
}

.form-group-admin input,
.form-group-admin select,
.form-group-admin textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border 0.2s;
}

.form-group-admin input:focus,
.form-group-admin select:focus,
.form-group-admin textarea:focus {
  outline: none;
  border-color: var(--admin-accent);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--admin-shadow-lg);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--admin-text-light);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--admin-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1001;
  background: var(--admin-primary);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 8px;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn:active {
  transform: scale(0.95);
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  -webkit-tap-highlight-color: transparent;
}

.sidebar-overlay.show {
  display: block;
}

/* Responsive */
@media (max-width: 768px) {
  /* Show mobile menu button */
  .mobile-menu-btn {
    display: flex;
  }

  /* Hide sidebar by default on mobile */
  .admin-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
  }

  /* Show sidebar when mobile-open class is added */
  .admin-sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Make nav links more tappable on mobile */
  .admin-nav-item {
    padding: 18px 24px !important;
    font-size: 1rem !important;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .admin-nav-item:active {
    background: rgba(255, 255, 255, 0.2) !important;
  }

  /* Main content takes full width on mobile */
  .admin-main {
    margin-left: 0 !important;
    padding: 80px 15px 20px 15px !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Single column stats on mobile */
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }

  /* Reduce padding on cards */
  .admin-card {
    padding: 16px !important;
  }

  /* Stack header on mobile */
  .admin-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
  }

  .admin-header h1 {
    font-size: 1.5rem !important;
  }

  /* Make tables responsive - allow horizontal scroll */
  .admin-table {
    font-size: 0.85rem;
    display: block;
    overflow-x: auto;
  }

  .admin-table th,
  .admin-table td {
    padding: 10px 8px !important;
    white-space: nowrap;
  }

  /* Smaller buttons on mobile */
  .btn-primary,
  .btn-success,
  .btn-danger,
  .btn-warning {
    padding: 10px 16px !important;
    font-size: 0.9rem !important;
    -webkit-tap-highlight-color: transparent;
  }

  /* Full width modal on mobile */
  .modal-content {
    width: 95% !important;
    margin: 10px !important;
  }

  .modal-body {
    padding: 16px !important;
  }

  /* Stack form rows on mobile */
  .form-row {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .admin-main {
    padding: 70px 10px 15px 10px !important;
  }

  .admin-header h1 {
    font-size: 1.3rem !important;
  }

  .stat-value {
    font-size: 1.5rem !important;
  }

  .admin-table {
    font-size: 0.75rem;
  }
}
