/* Overlays, Modals and Panels */
.modal,
.log-overlay,
.profile-overlay,
#motorLogOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

/* Display show */
.log-overlay.show,
.profile-overlay.show,
.modal.show,
#motorLogOverlay.show {
  display: flex;
}

/* Log panel */
.log-panel {
  background-color: var(--card-background);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  padding: 1.5rem;
  overflow-y: auto;
}

.log-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  border-bottom: 2px solid var(--border-colour);
  padding-bottom: 0.4rem;
}

.scrollable-log {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* Motor log overlay */
#motorLogOverlay {
  align-items: center;
  justify-content: center;
}

.motor-log-panel {
  width: 90%;
  max-width: 650px;
  max-height: 80vh;
  background-color: var(--card-background);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  overflow-y: auto;
  position: relative;
  animation: fadeIn 0.3s ease-out;
}

/* Profile overlay */
.profile-panel-content {
  background-color: var(--card-background);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 90%;
  max-width: 450px;
  max-height: 80vh;
  padding: 1.5rem;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.4s ease-in-out;
}

.profile-overlay.show .profile-panel-content {
  transform: translateX(0);
}

#farmerNameLabel {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-colour);
}

/* Admin login modal */
.modal-content {
  background-color: var(--card-background);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-align: center;
}

.modal-content input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-colour);
  border-radius: var(--radius-md);
  font-size: 1rem;
  background-color: #fdfdfd;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.modal-content input:focus {
  outline: none;
  border-color: var(--primary-colour);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.modal-buttons {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.modal-buttons button {
  flex: 1;
  padding: 0.65rem;
  font-size: 1rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.2s ease;
}

#adminLoginSubmit {
  background-color: var(--primary-colour);
  color: #fff;
}

#adminLoginSubmit:hover {
  background-color: var(--primary-hover);
}

#closeAdminModal {
  background-color: var(--border-colour);
  color: var(--text-colour);
}

#closeAdminModal:hover {
  background-color: #d1d5db;
}

/* Profile overlay backdrop */
.profile-overlay-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(5px);
  display: none;
  z-index: 9998;
}

.profile-overlay-backdrop.show {
  display: flex;
}

/* Close button styles */
.close-motor-log,
.close-log-btn {
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 4px !important;
  position: absolute;
  top: 14px;
  right: 18px;
  cursor: pointer;
  opacity: 0.92;
  z-index: 10;
  width: auto;
  height: auto;
}

.close-motor-log svg,
.close-log-btn svg {
  display: block;
  width: 28px;
  height: 28px;
  fill: #e3e3e3;
  transition: fill 0.2s;
}

.close-motor-log:hover svg,
.close-log-btn:hover svg {
  fill: #fff;
}

.close-log-btn {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--danger-colour);
  border: none;
  color: #fff;
  font-size: 1.3em;
  cursor: pointer;
  z-index: 1;
  opacity: 0.93;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-log-btn svg {
  display: block;
  width: 28px;
  height: 28px;
}

/* Slide-in panel for logs */
.log-panel,
.motor-log-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 420px;
  max-width: 96vw;
  min-width: 320px;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.7, 0, 0.3, 1);
  box-shadow: -6px 0 24px #0009;
  z-index: 10001;
  background: #1b1c22 !important;
  color: #fff !important;
  overflow-y: auto !important;
  border-radius: 1.3em !important;
  padding: 1.4em 1.2em !important;
  font-size: 1.13em !important;
}

.log-panel.open,
.motor-log-panel.open {
  transform: translateX(0);
}

/* Payment Overlay Styles */
.payment-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.payment-panel {
  background: #1a1a1a;
  border-radius: 15px;
  padding: 30px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  border: 1px solid #333;
}

.close-payment-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  border-radius: 5px;
  transition: background 0.3s;
}

.close-payment-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.payment-header {
  text-align: center;
  margin-bottom: 30px;
  color: white;
}

.payment-header h2 {
  margin: 0 0 15px 0;
  color: #3399cc;
}

.subscription-plans {
  display: grid;
  gap: 20px;
  margin-bottom: 30px;
}

.subscription-plan {
  background: #2a2a2a;
  border-radius: 10px;
  padding: 20px;
  border: 2px solid #333;
  transition: border-color 0.3s;
}

.subscription-plan:hover {
  border-color: #3399cc;
}

.plan-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.plan-header h3 {
  margin: 0;
  color: white;
}

.plan-price {
  font-size: 24px;
  font-weight: bold;
  color: #3399cc;
}

.plan-features {
  color: #ccc;
  margin-bottom: 20px;
  line-height: 1.5;
}

.select-plan-btn {
  width: 100%;
  padding: 12px;
  background: #3399cc;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s;
}

.select-plan-btn:hover {
  background: #2980b9;
}

.payment-footer {
  text-align: center;
  color: #999;
  font-size: 14px;
  border-top: 1px solid #333;
  padding-top: 20px;
}

.loading-message {
  text-align: center;
  padding: 20px;
  color: #3399cc;
  font-size: 16px;
}

/* === VIBRANT LOG PANEL (Deep Space & Neon) === */

/* 1. Header Styling */
.log-section-title,
.motor-log-panel h2 {
  font-family: "League Spartan", sans-serif !important;
  font-size: 1.5rem !important;
  font-weight: 700;
  /* Gradient Text for the Header */
  background: linear-gradient(to right, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;

  text-align: center;
  margin-bottom: 1.5rem !important;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 12px;
}

/* 2. The Log Card (Rich Gradient Glass) */
.log-entry {
  position: relative;
  /* RICH GRADIENT: Lighter slate at top-left, Darker at bottom-right */
  background: linear-gradient(
    145deg,
    rgba(51, 65, 85, 0.5) 0%,
    rgba(15, 23, 42, 0.85) 100%
  ) !important;

  /* SHARP BORDERS: Brighter top border simulates light hitting the glass */
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.25) !important;
  border-left: 1px solid rgba(255, 255, 255, 0.15) !important;

  margin-bottom: 14px;
  padding: 16px 18px !important;
  border-radius: 16px !important;

  /* Deep shadow for pop */
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3) !important;

  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
}

/* Hover Effect: Card lights up slightly */
.log-entry:hover {
  transform: translateY(-2px);
  background: linear-gradient(
    145deg,
    rgba(51, 65, 85, 0.7) 0%,
    rgba(15, 23, 42, 0.9) 100%
  ) !important;
  border-top-color: rgba(255, 255, 255, 0.4) !important;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4) !important;
}

/* 3. Top Row */
.log-dot-and-time {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px !important;
}

/* 4. Super Neon Dots */
.status-dot {
  width: 10px !important;
  height: 10px !important;
  border-radius: 50%;
  position: relative;
}

/* Green (Online) - Intense Glow */
.status-dot.dot-online {
  background-color: #22c55e;
  box-shadow:
    0 0 10px #22c55e,
    0 0 20px rgba(34, 197, 94, 0.5);
}

/* Red (Offline) - Intense Glow */
.status-dot.dot-offline {
  background-color: #ef4444;
  box-shadow:
    0 0 10px #ef4444,
    0 0 20px rgba(239, 68, 68, 0.5);
}

/* 5. Timestamp */
.log-timestamp {
  font-family: "League Spartan", sans-serif;
  font-size: 0.75rem !important;
  font-weight: 700;
  letter-spacing: 1px;
  color: #94a3b8 !important;
  text-transform: uppercase;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* 6. Main Status Text (Crisp White) */
.log-status {
  font-family: "League Spartan", sans-serif;
  font-size: 1.15rem !important;
  font-weight: 700;
  color: #ffffff !important;
  letter-spacing: 0.5px;
  margin-left: 22px !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); /* Pop text off background */
}

/* 7. Duration Text (Cyan Highlight) */
.log-entry div:last-child {
  margin-left: 22px;
  font-family: "League Spartan", sans-serif;
  font-size: 0.85rem !important;
  color: #cbd5e1 !important;
  margin-top: 6px !important;
}

.log-entry b {
  color: #38bdf8; /* Cyan */
  font-weight: 700;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.4); /* Glowing numbers */
}

/* === Change Password Button (inside profile panel) === */
.profile-action-btn {
  width: 100%;
  padding: 0.65rem;
  font-size: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md, 8px);
  background: rgba(51, 153, 204, 0.12);
  color: #87ceeb;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  margin-bottom: 0.5rem;
}
.profile-action-btn:hover {
  background: rgba(51, 153, 204, 0.28);
  color: #fff;
}

/* === Change Password Modal === */
.change-pw-content {
  gap: 0.65rem;
}
.change-pw-subtitle {
  font-size: 0.88rem;
  color: #94a3b8;
  margin: -0.25rem 0 0.25rem;
  text-align: center;
}
.change-pw-error {
  color: #f87171;
  font-size: 0.88rem;
  text-align: center;
  margin: 0;
}
.change-pw-success {
  color: #4ade80;
  font-size: 0.88rem;
  text-align: center;
  margin: 0;
}
#changePasswordSubmit {
  background-color: var(--primary-colour, #2563eb);
  color: #fff;
}
#changePasswordSubmit:hover {
  background-color: var(--primary-hover, #1d4ed8);
}
#closeChangePasswordModal {
  background-color: var(--border-colour, #e5e7eb);
  color: var(--text-colour, #111);
}
#closeChangePasswordModal:hover {
  background-color: #d1d5db;
}
