/*
==================================================================
  SaveLives - Main Production Stylesheet (v2.8)
==================================================================
  This file works WITH TailwindCSS to provide global styles,
  variables, animations, and internationalization support.
------------------------------------------------------------------
*/

/* 
  SECTION 1: CSS VARIABLES (THEMEING)
  This controls the entire color scheme for light and dark modes.
*/
:root {
  --bg-primary: #f9fafb; /* gray-50 */
  --bg-secondary: #ffffff; /* white */
  --bg-tertiary: #f3f4f6; /* gray-100 */
  --text-primary: #1f2937; /* gray-800 */
  --text-secondary: #6b7280; /* gray-500 */
  --text-on-primary-brand: #ffffff;
  --brand-primary: #dc2626; /* red-600 */
  --brand-secondary: #b91c1c; /* red-700 */
  --border-color: #e5e7eb; /* gray-200 */
  --shadow-color: rgba(0, 0, 0, 0.05);
  --accent-teal: #14b8a6; /* teal-500 */
}

/* 
  SECTION 2: DARK MODE THEME
  When html.dark is present, these variables take precedence.
*/
html.dark {
  --bg-primary: #111827; /* gray-900 */
  --bg-secondary: #1f2937; /* gray-800 */
  --bg-tertiary: #374151; /* gray-700 */
  --text-primary: #f9fafb; /* gray-50 */
  --text-secondary: #9ca3af; /* gray-400 */
  --border-color: #374151; /* gray-700 */
  --shadow-color: rgba(0, 0, 0, 0.2);
  --accent-teal: #2dd4bf; /* teal-400 */
}

/* 
  SECTION 3: GLOBAL STYLES & RESETS
*/
*, *::before, *::after {
  /* Smooth color transitions for dark/light mode switch */
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
html { scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/*
  SECTION 4: CUSTOM COMPONENT STYLES
*/
/* Hotspot animation for the index.php map preview */
.hotspot {
  position: absolute; width: 12px; height: 12px; background-color: var(--brand-primary);
  border-radius: 9999px; border: 2px solid white; box-shadow: 0 0 8px var(--brand-primary);
}
.hotspot::before {
  content: ''; position: absolute; top: 50%; left: 50%; width: 100%; height: 100%;
  background-color: var(--brand-primary); border-radius: 9999px;
  transform: translate(-50%, -50%); animation: pulse 2s infinite ease-out; opacity: 0.7;
}
@keyframes pulse {
  0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.7; }
  70% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
}
/* Theme toggle switch styling */
#theme-toggle-input:checked ~ .dot { transform: translateX(1.25rem); }
#theme-toggle-input:checked ~ .block { background-color: var(--accent-teal); }
/* SOS Blinking Indicator */
.sos-blink {
  animation: blink 1.5s infinite;
}
@keyframes blink {
  50% { opacity: 0.5; }
}
/* Action Card Enhancements */
.action-card {
  min-height: 120px;
}
.action-card-icon {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.action-card:hover .action-card-icon {
  transform: scale(1.1);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
/* Content Card Enhancements */
.content-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.content-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}
/* PWA Install Button */
#pwa-install-container {
  transition: opacity 0.3s ease;
}
#pwa-install-container.hidden {
  opacity: 0;
  height: 0;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

/* 
  SECTION 5: GLOBAL FORM STYLING
  This provides a consistent look for all form elements.
*/
input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="search"], input[type="url"],
textarea, select {
  display: block; width: 100%; padding: 0.75rem; font-size: 1rem; color: var(--text-primary);
  background-color: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: 0.5rem; box-shadow: 0 1px 2px 0 var(--shadow-color);
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid transparent; outline-offset: 2px; border-color: var(--accent-teal);
  box-shadow: 0 0 0 2px var(--accent-teal);
}
.btn {
  display: inline-block; padding: 0.75rem 1.5rem; font-weight: 600; text-align: center;
  border-radius: 0.5rem; cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background-color: var(--accent-teal); color: var(--text-on-primary-brand); }
.btn-primary:hover { background-color: #2dd4bf; } /* Slightly lighter teal on hover */
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 
  SECTION 6: RTL (Right-to-Left) Language Support
*/
html[dir="rtl"] {
  direction: rtl;
  text-align: right;
}
html[dir="rtl"] #sidebar-menu {
  left: auto; right: 0; transform: translateX(100%);
}
html[dir="rtl"] #sidebar-menu.-translate-x-full {
  transform: translateX(100%);
}
html[dir="rtl"] .ml-3 { margin-left: 0; margin-right: 0.75rem; }
html[dir="rtl"] .mr-3 { margin-right: 0; margin-left: 0.75rem; }
html[dir="rtl"] .space-x-2 > * + * { margin-right: 0.5rem; margin-left: 0; }
html[dir="rtl"] .space-x-3 > * + * { margin-right: 0.75rem; margin-left: 0; }
html[dir="rtl"] .space-x-6 > * + * { margin-right: 1.5rem; margin-left: 0; }

/* 
  SECTION 7: RESPONSIVE ADJUSTMENTS
*/
@media (max-width: 1024px) {
  .action-card {
    padding: 8px;
    min-height: 80px;
  }
  .action-card-icon {
    width: 12px;
    height: 12px;
  }
  .action-card-icon i {
    font-size: 1.5rem;
  }
  .action-card-title {
    font-size: 0.875rem;
  }
  .content-card {
    padding: 4px;
  }
  #sidebar-menu {
    width: 240px;
  }
  .lg:ml-80 {
    margin-left: 0;
  }
  #sidebar-menu {
    border-radius: 0.5rem;
  }
}

@media (min-width: 1025px) {
  #sidebar-menu {
    width: 80px;
    min-height: calc(100vh - 4rem);
    padding: 1rem;
  }
  .lg:ml-80 {
    margin-left: 80px;
  }
  .content-card {
    min-height: 200px;
  }
  #sidebar-menu ul li a {
    padding: 0.5rem;
    text-align: left;
  }
  #sidebar-menu ul li a i {
    margin-right: 0.5rem;
  }
  #sidebar-menu {
    border: 4px solid;
    border-color: var(--border-color);
  }
}