/* PhoneShare2 Custom Styles */
/* Consolidated custom styles for all pages */

/* Online/Offline Status Indicator */
#status-indicator {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10000;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #4caf50; /* green for online */
  transition: background-color 0.3s ease;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

#status-indicator.offline {
  background-color: #ffc107; /* yellow for offline */
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 3rem; /* Move left to make room for status indicator */
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: var(--pico-background-color);
  color: var(--pico-color);
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border-left: 4px solid var(--pico-primary);
  opacity: 1;
  transform: translateX(120%);
  transition: all 0.3s ease;
  pointer-events: auto;
  max-width: 100%;
  word-wrap: break-word;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-success {
  border-left-color: #4caf50;
  background: rgb(76, 175, 80);
}

.toast-error {
  border-left-color: #f44336;
  background: rgb(244, 67, 54);
}

.toast-warning {
  border-left-color: #ff9800;
  background: rgb(255, 152, 0);
}

.toast-info {
  border-left-color: #2196f3;
  background: rgb(33, 150, 243);
}

.toast-confirm {
  border-left-color: var(--pico-primary);
}

.toast-message {
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.toast-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.toast-btn-confirm,
.toast-btn-cancel {
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.toast-btn-confirm {
  background: var(--pico-primary);
  color: white;
}

.toast-btn-confirm:hover {
  opacity: 0.9;
}

.toast-btn-cancel {
  background: var(--pico-muted-border-color);
  color: var(--pico-color);
}

.toast-btn-cancel:hover {
  opacity: 0.8;
}

/* Mobile toast positioning */
@media (max-width: 576px) {
  #toast-container {
    left: 1rem;
    right: 1rem;
    max-width: none;
  }
}

/* Base page styles */
body {
  padding: 1rem;
  padding-bottom: 5rem; /* Space for sticky footer nav */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* Typography */
.muted {
  color: #666;
  font-size: .95rem;
}

/* Bottom Navigation - Sticky footer */
footer.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--pico-background-color);
  border-top: 1px solid var(--pico-muted-border-color);
  padding: 0.75rem 0;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

footer.bottom-nav nav ul {
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0.1rem;
  list-style: none;
  justify-content: center;
  align-items: center;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 0.2rem;
}

footer.bottom-nav nav ul li {
  margin: 0;
  flex: 1;
  max-width: 180px; /* Reduced from 200px to fit 4 buttons */
}

footer.bottom-nav nav a[role="button"] {
  width: 100%;
  padding: 0.5rem 0.75rem; /* Slightly reduced horizontal padding */
  font-size: 0.85rem; /* Slightly smaller for 4 buttons */
  margin: 0;
  text-align: center;
  white-space: nowrap;
}

/* Disabled/Current page button styling */
footer.bottom-nav nav a[role="button"][disabled],
footer.bottom-nav nav a[role="button"][aria-current="page"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  background-color: var(--pico-primary-focus);
  border-color: var(--pico-primary);
  color: var(--pico-primary);
}

/* Index page - Counter styles */
.index-page body {
  text-align: center;
}

.index-page header .logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
}

.index-page .headline {
  margin: 2rem 0;
}

.index-page .counters {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin: 3rem 0;
}

.index-page .counter {
  padding: 2rem;
  border-radius: 1rem;
  font-size: 4rem;
  font-weight: bold;
  min-width: 150px;
}

.index-page .queued {
  background: var(--pico-color, lightgreen);
  color: darkgreen;
}

.index-page .dead {
  background: var(--pico-color, lightcoral);
  color: darkred;
}

.index-page .muted {
  margin-bottom: 2rem;
}

/* Diagnostics page */
.diagnostics-page header .logo {
  width: 32px;
  height: 32px;
}

.diagnostics-page pre#diag-log {
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
}

.diagnostics-page .outbox-item {
  border-bottom: 1px solid var(--pico-card-sectioning-background-color);
  padding: .6rem 0;
}

/* Config page - inherits base styles only */

/* DLQ page */
.dlq-summary {
  text-align: center;
  font-size: 1.2rem;
  margin: 1rem 0;
}

.dlq-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.dlq-item {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.5rem;
}

.dlq-item header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dlq-item p {
  margin: 0.5rem 0;
  word-wrap: break-word;
}

.dlq-item details {
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.dlq-item details ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.dlq-item-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.dlq-item-actions button {
  flex: 1;
  min-width: 120px;
}

/* Mobile responsiveness - Mobile First Approach */
@media (max-width: 576px) {
  /* Bottom navigation - larger touch targets */
  footer.bottom-nav nav a[role="button"] {
    font-size: 0.8rem;
    padding: 0.75rem 0.5rem;
    min-height: 44px; /* iOS HIG minimum */
    display: flex;
    align-items: center;
    justify-content: center;
  }

  footer.bottom-nav nav ul {
    gap: 0.25rem;
    padding: 0 0.5rem;
  }

  footer.bottom-nav nav ul li {
    max-width: 160px;
  }

  /* Toast improvements for mobile */
  #toast-container {
    left: 1rem;
    right: 1rem;
    top: 1rem;
    max-width: none;
  }

  .toast {
    font-size: 1rem;
    padding: 1.25rem 1.5rem;
  }

  .toast-actions {
    flex-direction: column-reverse; /* Cancel first, then confirm */
    gap: 0.75rem;
  }

  .toast-btn-confirm,
  .toast-btn-cancel {
    width: 100%;
    min-height: 44px;
    font-size: 1rem;
    padding: 0.75rem 1rem;
  }

  /* Body spacing for mobile */
  body {
    padding: 0.75rem;
    padding-bottom: 6rem; /* More space for larger nav */
  }

  /* Counter improvements for mobile */
  .index-page .counters {
    gap: 1rem;
    margin: 2rem 0;
  }

  .index-page .counter {
    padding: 1.5rem;
    font-size: 3rem;
    min-width: 120px;
  }

  /* Diagnostics grid - stack on mobile */
  .diagnostics-page .grid {
    display: block;
  }

  .diagnostics-page .grid > div {
    margin-bottom: 2rem;
  }

  /* DLQ item improvements */
  .dlq-item-actions {
    flex-direction: column;
  }

  .dlq-item-actions button {
    width: 100%;
    min-height: 44px;
    margin-bottom: 0.5rem;
  }

  /* Form improvements */
  form input,
  form button {
    min-height: 44px;
    font-size: 1rem;
  }

  /* Button groups */
  .btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .btn-group button {
    width: 100%;
    min-height: 44px;
  }

  /* DLQ actions */
  .dlq-actions {
    flex-direction: column;
  }

  .dlq-actions button {
    width: 100%;
    min-height: 44px;
    margin-bottom: 0.5rem;
  }
}

/* Additional mobile enhancements */
@media (max-width: 768px) {
  /* Improve readability */
  body {
    font-size: 1rem;
    line-height: 1.5;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  /* Better spacing for touch */
  article {
    margin-bottom: 1.5rem;
  }

  /* Status indicator positioning */
  #status-indicator {
    top: 0.75rem;
    right: 0.75rem;
    width: 14px;
    height: 14px;
  }
}