* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #111827;
  color: white;
  min-height: 100vh;
  line-height: 1.6;
}

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

/* Header Styles */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #374151;
  background: #1f2937;
  animation: slideInDown 0.6s ease-out;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: #facc15;
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    text-shadow: 0 0 5px #facc15;
  }
  to {
    text-shadow: 0 0 20px #facc15, 0 0 30px #facc15;
  }
}

.welcome-text {
  font-size: 0.875rem;
  color: #d1d5db;
  margin-top: 0.25rem;
}

.store-btn {
  background: transparent;
  border: 1px solid #4b5563;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.store-btn:hover {
  background-color: #374151;
  border-color: #facc15;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 1rem;
  animation: fadeIn 0.8s ease-out;
}

.section {
  margin-bottom: 1.5rem;
  animation: slideInUp 0.6s ease-out;
  animation-fill-mode: both;
}

.section:nth-child(1) {
  animation-delay: 0.1s;
}
.section:nth-child(2) {
  animation-delay: 0.2s;
}
.section:nth-child(3) {
  animation-delay: 0.3s;
}
.section:nth-child(4) {
  animation-delay: 0.4s;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #facc15;
  position: relative;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 50px;
  height: 2px;
  background: #facc15;
  animation: expandWidth 0.8s ease-out;
}

@keyframes expandWidth {
  from {
    width: 0;
  }
  to {
    width: 50px;
  }
}

/* Buttons */
.btn {
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-size: 0.875rem;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background-color: #facc15;
  color: black;
  width: 100%;
  justify-content: center;
}

.btn-primary:hover {
  background-color: #eab308;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(250, 204, 21, 0.3);
}

.btn-secondary {
  background-color: #6b7280;
  color: white;
}

.btn-secondary:hover {
  background-color: #4b5563;
  transform: translateY(-2px);
}

.btn-purple {
  background-color: #7c3aed;
  color: white;
}

.btn-purple:hover {
  background-color: #6d28d9;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(124, 58, 237, 0.3);
}

.btn-red {
  background-color: #ef4444;
  color: white;
}

.btn-red:hover {
  background-color: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.btn-icon {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
}

.btn-sm {
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
}

/* Cards */
.card {
  background-color: #374151;
  border: 1px solid #4b5563;
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(250, 204, 21, 0.1), transparent);
  transition: left 0.6s;
}

.card:hover::before {
  left: 100%;
}

.card:hover {
  border-color: #facc15;
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.vehicle-card-animated {
  animation: slideInLeft 0.6s ease-out;
}

.message-card-animated {
  animation: bounceIn 0.8s ease-out;
}

.card-yellow {
  background-color: #facc15;
  color: black;
  border-color: #eab308;
}

.card-purple {
  background-color: #7c3aed;
  color: white;
  border-color: #6d28d9;
}

.card-red {
  background-color: #ef4444;
  color: white;
  border-color: #dc2626;
}

.card-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vehicle-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.vehicle-info {
  flex: 1;
}

.vehicle-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #facc15;
  animation: fadeInLeft 0.6s ease-out;
}

.vehicle-model {
  color: #9ca3af;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  animation: fadeInLeft 0.8s ease-out;
}

.vehicle-description {
  color: #d1d5db;
  font-size: 0.875rem;
  line-height: 1.5;
  animation: fadeInLeft 1s ease-out;
}

.vehicle-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Emergency Section */
.emergency-section {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  padding: 1.5rem;
  border-radius: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 10px 25px rgba(124, 58, 237, 0.3);
  animation: slideInUp 0.8s ease-out;
}

.emergency-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.emergency-title {
  font-size: 1.25rem;
  font-weight: 600;
  animation: pulse 2s infinite;
}

.emergency-description {
  color: #c4b5fd;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.emergency-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.emergency-item {
  background-color: #ef4444;
  padding: 1rem;
  border-radius: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  animation: slideInRight 0.6s ease-out;
}

.emergency-item:hover {
  background-color: #dc2626;
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.emergency-item-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.emergency-icon {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  animation: spin 3s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.emergency-icon-red {
  background-color: #dc2626;
}

.emergency-icon-yellow {
  background-color: #facc15;
}

.emergency-icon-dot {
  width: 0.5rem;
  height: 0.5rem;
  background-color: white;
  border-radius: 50%;
}

/* Communication Options */
.communication-options {
  padding: 1rem;
  animation: fadeInUp 0.8s ease-out;
}

.communication-item {
  background-color: #374151;
  padding: 1rem;
  border-radius: 0.75rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid #4b5563;
  animation: slideInLeft 0.6s ease-out;
}

.communication-item:hover {
  background-color: #4b5563;
  border-color: #facc15;
  transform: translateX(10px) scale(1.02);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

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

/* Phone Display */
.phone-display {
  background-color: #374151;
  border: 2px solid #facc15;
  padding: 1.5rem;
  text-align: center;
  border-radius: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 0 20px rgba(250, 204, 21, 0.3);
  animation: bounceIn 1s ease-out;
}

.phone-number {
  font-size: 1.5rem;
  font-weight: bold;
  color: #facc15;
  cursor: pointer;
  margin: 0;
  animation: pulse 2s infinite;
}

.phone-number a {
  color: inherit;
  text-decoration: none;
  transition: all 0.3s ease;
}

.phone-number a:hover {
  text-shadow: 0 0 20px rgba(250, 204, 21, 0.8);
  transform: scale(1.1);
}

/* Test Area */
.test-area {
  background-color: #374151;
  border: 1px solid #4b5563;
  border-radius: 0.75rem;
  padding: 1rem;
}

.test-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.test-dot {
  width: 0.5rem;
  height: 0.5rem;
  background-color: #facc15;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

.test-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #facc15;
}

.test-description {
  color: #d1d5db;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* Footer */
.footer {
  margin-top: auto;
  padding: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: #6b7280;
  border-top: 1px solid #374151;
  background: #1f2937;
  animation: slideInUp 0.6s ease-out;
}

.footer .highlight {
  color: #facc15;
  font-weight: 600;
  animation: glow 2s ease-in-out infinite alternate;
}

/* Icons */
.icon {
  width: 1.25rem;
  height: 1.25rem;
  stroke-width: 2;
  flex-shrink: 0;
}

/* Loading */
.loading {
  display: none;
  text-align: center;
  padding: 2rem;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #1f2937;
  border-radius: 1rem;
  z-index: 1000;
  border: 2px solid #facc15;
}

.spinner {
  border: 4px solid #374151;
  border-top: 4px solid #facc15;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

/* Form Styles */
.vehicle-form {
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.form-section {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #374151;
  animation: fadeInUp 0.6s ease-out;
}

.form-section:last-of-type {
  border-bottom: none;
}

.form-section h4 {
  color: #facc15;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #d1d5db;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #4b5563;
  border-radius: 0.5rem;
  background: #374151;
  color: white;
  font-size: 0.875rem;
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #facc15;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.1);
  transform: scale(1.02);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #374151;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Message Styles */
.message-item {
  transition: all 0.3s ease;
  animation: slideInLeft 0.6s ease-out;
}

.message-item.unread {
  border-left-width: 4px !important;
  animation: glow 2s ease-in-out infinite alternate;
}

.messages-container {
  scrollbar-width: thin;
  scrollbar-color: #facc15 #374151;
}

.messages-container::-webkit-scrollbar {
  width: 6px;
}

.messages-container::-webkit-scrollbar-track {
  background: #374151;
  border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb {
  background: #facc15;
  border-radius: 3px;
}

/* Animations */
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .header {
    padding: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .header > div:first-child {
    flex: 1;
  }

  .welcome-text {
    font-size: 0.75rem;
  }

  .main-content {
    padding: 0.75rem;
  }

  .vehicle-card {
    flex-direction: column;
    gap: 1rem;
  }

  .vehicle-actions {
    align-self: stretch;
    justify-content: space-between;
  }

  .emergency-section {
    padding: 1rem;
  }

  .emergency-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .emergency-item {
    padding: 0.75rem;
  }

  .communication-item {
    padding: 0.75rem;
  }

  .phone-display {
    padding: 1rem;
  }

  .phone-number {
    font-size: 1.25rem;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .modal-content {
    margin: 0.5rem !important;
    padding: 1rem !important;
    max-height: 95vh !important;
  }

  .vehicle-form {
    max-height: 80vh;
  }

  .btn {
    padding: 1rem;
    font-size: 1rem;
    min-height: 48px;
  }

  .btn-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
  }

  .card {
    padding: 1rem;
  }

  .section-title {
    font-size: 1.1rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-number {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 0.5rem;
  }

  .logo {
    font-size: 1.25rem;
  }

  .main-content {
    padding: 0.5rem;
  }

  .emergency-section {
    padding: 0.75rem;
  }

  .communication-options {
    padding: 0.5rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .form-section h4 {
    font-size: 1rem;
  }

  .modal-content {
    padding: 0.75rem !important;
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 44px;
    padding: 0.875rem 1rem;
  }

  .btn-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }

  .emergency-item,
  .communication-item {
    min-height: 60px;
    padding: 1rem;
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    min-height: 44px;
    padding: 0.875rem;
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Dark mode enhancements */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #0f172a;
  }

  .card {
    background-color: #1e293b;
    border-color: #334155;
  }

  .header {
    background: #0f172a;
    border-color: #1e293b;
  }

  .footer {
    background: #0f172a;
    border-color: #1e293b;
  }
}

/* Print styles */
@media print {
  .header,
  .footer,
  .btn,
  .communication-options {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .card {
    border: 1px solid #ccc !important;
    background: white !important;
    color: black !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .btn-primary {
    background: #000;
    color: #fff;
    border: 2px solid #fff;
  }

  .card {
    border-width: 2px;
  }

  .emergency-item {
    border: 2px solid #fff;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .test-dot {
    animation: none;
  }

  .message-item.unread {
    animation: none;
  }
}
