/* CSS Variables for theming */
:root {
  --primary-color: #dc2626;
  --primary-dark: #b91c1c;
  --secondary-color: #f97316;
  --background-color: #ffffff;
  --surface-color: #f8fafc;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 12px;
  --transition: all 0.2s ease-in-out;
}

/* Dark mode variables */
[data-theme="dark"] {
  --background-color: #0f172a;
  --surface-color: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border-color: #334155;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--background-color);
  color: var(--text-primary);
  line-height: 1.6;
  transition: var(--transition);
  padding-bottom: 80px; /* Space for bottom nav */
}

/* Header */
.header {
  background: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  font-size: 2rem;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-primary);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: var(--border-color);
}

.language-selector {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.5rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
}

/* Search */
.search-container {
  padding: 1rem;
  background: var(--background-color);
}

.search-bar {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 3rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--surface-color);
  color: var(--text-primary);
  font-size: 1rem;
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgb(220 38 38 / 0.1);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

.search-clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.25rem;
  border-radius: 50%;
  transition: var(--transition);
}

.search-clear:hover {
  background: var(--border-color);
}

/* Main Content */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.section {
  margin-bottom: 2rem;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.section-title .material-icons {
  color: var(--primary-color);
}

/* Contact List */
.contact-list {
  display: grid;
  gap: 0.75rem;
}

.contact-item {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  transition: var(--transition);
  cursor: pointer;
}

.contact-item:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow);
}

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

.contact-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.contact-type {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.contact-phone {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--primary-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.contact-phone:hover {
  color: var(--primary-dark);
}

.contact-info {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface-color);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: 0.5rem 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.nav-item {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: var(--transition);
  color: var(--text-secondary);
  min-width: 60px;
}

.nav-item.active {
  color: var(--primary-color);
}

.nav-item:hover {
  background: var(--border-color);
}

.nav-label {
  font-size: 0.75rem;
  font-weight: 500;
}

/* SOS Button */
.sos-button {
  position: fixed;
  bottom: 100px;
  right: 1rem;
  width: 60px;
  height: 60px;
  background: var(--primary-color);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
  z-index: 99;
}

.sos-button:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.sos-button:active {
  transform: scale(0.95);
}

.sos-text {
  font-size: 0.75rem;
  margin-top: -2px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--surface-color);
  border-radius: var(--radius);
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.25rem;
  border-radius: 50%;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--border-color);
}

.modal-content {
  padding: 1rem;
}

.modal-content p {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--text-secondary);
  color: white;
}

.btn-danger {
  background: var(--primary-color);
  color: white;
}

.btn-danger:hover {
  background: var(--primary-dark);
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-content {
    padding: 0.75rem 1rem;
  }
  
  .logo h1 {
    font-size: 1.25rem;
  }
  
  .search-container {
    padding: 0.75rem 1rem;
  }
  
  .main-content {
    padding: 0 1rem;
  }
  
  .contact-item {
    padding: 0.75rem;
  }
  
  .sos-button {
    width: 56px;
    height: 56px;
    bottom: 90px;
  }
}

@media (max-width: 480px) {
  .header-actions {
    gap: 0.5rem;
  }
  
  .language-selector {
    font-size: 0.75rem;
    padding: 0.375rem;
  }
  
  .nav-label {
    font-size: 0.625rem;
  }
  
  .contact-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.contact-item {
  animation: fadeIn 0.3s ease-out;
}

/* Print styles */
@media print {
  .header,
  .search-container,
  .bottom-nav,
  .sos-button {
    display: none;
  }
  
  .main-content {
    padding: 0;
  }
  
  .contact-item {
    break-inside: avoid;
    margin-bottom: 0.5rem;
  }
}

