@import url('/assets/fonts/fonts.css');

:root {
  --primary-blue: #2D5BFF;
  --primary-blue-hover: #1A44E6;
  --accent-red: #FF4D4D;
  --bg-color: #F4F7FB;
  --text-dark: #1E293B;
  --text-light: #F8FAFC;
  --border-color: #E2E8F0;
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  --card-shadow-hover: 0 20px 45px rgba(45, 91, 255, 0.1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* Splash Screen */
#splash-screen {
  position: fixed;
  inset: 0;
  background: white;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s;
}

#splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-content {
  text-align: center;
  animation: splashIn 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.splash-footer {
  position: absolute;
  bottom: 3.5rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  animation: fadeIn 1s 0.5s both;
}

.footer-logo {
  width: 45px;
  height: auto;
}

.footer-text {
  text-align: left;
  font-weight: 800;
  font-size: 0.75rem;
  line-height: 1.2;
  color: #1e293b;
  letter-spacing: 0.5px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  margin-top: 0.5rem;
  background: transparent;
  width: 100%;
}

.footer-container {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.splash-logo {
  width: 100px;
  height: 100px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 53, 128, 0.15);
  margin-bottom: 1.5rem;
}

@keyframes splashIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* Page Animations */
.animate-in {
  animation: slideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

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

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

/* Global Styles */
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  margin: 0;
  padding: 0;
  padding-bottom: 90px;
  background-color: var(--bg-color);
  color: var(--text-dark);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Background Canvas */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
}

h1, h2, h3 {
  font-family: 'Sora', sans-serif;
  margin-top: 0;
}

.header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.35rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 15px rgba(0,0,0,0.03);
  position: sticky;
  top: 0;
  z-index: 1100;
  min-height: 60px;
}

.header-left {
  display: flex;
  align-items: center;
  z-index: 2;
}

.logo-container {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.header-logo {
  height: 48px;
  width: auto;
  max-width: 145px;
  object-fit: contain;
  display: block;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  z-index: 2;
}

@media (max-width: 360px) {
  .header {
    padding: 0.35rem 0.6rem;
  }
  .header-logo {
    height: 40px;
    max-width: 115px;
  }
  .header-actions {
    gap: 0.35rem;
  }
}

.logo-text-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.logo-text-policia {
  font-size: 1.18rem;
  line-height: 1.05;
  font-weight: 800;
  color: #00036C !important;
  margin: 0;
  text-align: center;
  letter-spacing: -0.04em;
  display: inline-block;
  transform: scaleX(0.92);
  transform-origin: center;
}

.logo-text-ime {
  font-size: 1.18rem;
  line-height: 1.05;
  font-weight: 800;
  color: #B82E24 !important;
  margin: 0;
  text-align: center;
  letter-spacing: 0.42em;
  margin-right: -0.42em;
  display: inline-block;
  transform: scaleX(1.18);
  transform-origin: center;
}

.police-badge {
  color: var(--primary-blue);
}

.hero-title,
.hero h2 {
  font-family: 'Exo 2', sans-serif;
  font-weight: 800;
  font-size: clamp(1.3rem, 6.13vw, 1.765rem);
  letter-spacing: 0.5px;
  margin: 0;
  line-height: 1.2;
  color: #AF0E0C !important;
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.hero-subtitle,
.hero p {
  font-family: 'Exo 2', sans-serif;
  font-size: clamp(0.72rem, 3.4vw, 0.98rem);
  letter-spacing: 0.2px;
  font-weight: 600 !important;
  margin: 0.25rem 0 0;
  color: #00036C !important;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

#lang-toggle {
  background: #F1F5F9;
  color: var(--text-dark);
  border: none;
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

main {
  max-width: 800px;
  margin: 1.2rem auto;
  padding: 0 1.2rem;
}

.hero {
  margin-bottom: 2rem;
}

.hero-card {
  background: white;
  border-radius: 28px;
  padding: 1rem; /* Reduced from 1.5rem */
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: row; /* Explicitly row */
  align-items: center;
  gap: 1rem;
  border: 1px solid rgba(255,255,255,0.8);
}

.hero-logo {
  width: 70px;
  height: 70px;
  min-width: 70px;
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

.hero-text h2 {
  margin: 0;
  font-size: 1.25rem; /* Slightly smaller to fit */
  color: var(--primary-blue);
  line-height: 1.2;
  white-space: nowrap; /* Keep in 1 line */
}

@media (max-width: 380px) {
  .hero-text h2 {
    font-size: 1.1rem;
  }
}

.hero-text p {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: #64748B;
}

/* Category Grid */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
}

.category-card {
  background: white;
  border-radius: 24px;
  padding: 1.5rem 0.8rem;
  text-align: center;
  border: 1px solid rgba(96, 165, 250, 0.38);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.16), 0 4px 18px rgba(0, 0, 0, 0.03), inset 0 1px 1.5px rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.category-card:hover {
  transform: translateY(-4px);
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.24), 0 8px 25px rgba(0, 0, 0, 0.05), inset 0 1px 1.5px rgba(255, 255, 255, 0.95);
}

.category-card .icon-wrapper {
  width: 60px;
  height: 60px;
  background: #F1F5FE;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: var(--primary-blue); /* SVGs inherit this via currentColor */
  transition: all 0.4s;
}

.category-card .icon-wrapper svg {
  width: 28px;
  height: 28px;
  stroke: var(--primary-blue);
  fill: none;
}

.category-card:hover .icon-wrapper {
  background: var(--primary-blue);
  color: white;
  box-shadow: 0 8px 20px rgba(45, 91, 255, 0.3);
}

.category-card:hover .icon-wrapper svg {
  stroke: white;
}

.category-card h3 {
  font-size: 0.9rem;
  margin: 0;
  font-weight: 700;
  color: var(--text-dark);
}

/* Forms */
.report-form-container {
  background: white;
  padding: 1.8rem;
  border-radius: 28px;
  box-shadow: var(--card-shadow);
  margin-bottom: 2rem;
  width: 100%;
}

.styled-form .form-group {
  margin-bottom: 1.2rem;
}

.styled-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #64748B;
}

.styled-form input,
.styled-form select,
.styled-form textarea {
  width: 100%;
  padding: 0.9rem 1.1rem;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-dark);
  transition: all 0.3s;
  box-sizing: border-box; /* Crucial for overflow */
}

/* Buttons */
.primary-btn {
  background: var(--primary-blue);
  color: white;
  padding: 1rem;
  border: none;
  border-radius: 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(45, 91, 255, 0.2);
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  left: 1.2rem;
  right: 1.2rem;
  background: linear-gradient(180deg, rgba(240, 247, 255, 0.42) 0%, rgba(215, 235, 255, 0.28) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  height: 55px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-radius: 24px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.03), inset 0 1px 1.5px rgba(255, 255, 255, 0.85), inset 0 -1px 1px rgba(255, 255, 255, 0.2);
  z-index: 1000;
  padding: 0 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.6);
  transform: translateZ(0); /* Fix for iOS Safari jumping */
}

.nav-btn {
  flex: 1;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #0F172A;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 6px;
  border-radius: 18px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.nav-btn svg {
  width: 22px;
  height: 22px;
  stroke: #0F172A;
  stroke-width: 2.2;
  transition: all 0.25s ease;
}

.nav-btn.active {
  color: var(--primary-blue);
  background: rgba(45, 91, 255, 0.12);
  transform: translateY(-1px);
}

.nav-btn.active svg {
  stroke: var(--primary-blue);
  stroke-width: 2.4;
}

.nav-btn-group {
  display: contents;
}

/* Case Card in Profile */
.case-item-card {
  background: white;
  border-radius: 22px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--card-shadow);
  margin-bottom: 0.8rem;
  width: 100%;
  box-sizing: border-box;
}

.case-card-icon {
  width: 54px;
  height: 54px;
  background: #F1F5FE;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-blue);
  flex-shrink: 0;
}

.case-card-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--primary-blue);
}

.case-card-info p {
  margin: 0;
  font-size: 0.8rem;
  color: #64748B;
}

.case-card-info strong {
  color: var(--text-dark);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}

.modal-content {
  background: white;
  padding: 2rem;
  width: 92%;
  max-width: 450px;
  border-radius: 28px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.2);
  max-height: 90vh;
  overflow-y: auto;
  box-sizing: border-box;
  position: relative;
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: #94A3B8;
  background: none;
  border: none;
  line-height: 1;
}

.back-btn {
  background: #F1F5F9;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  font-weight: 700;
  color: var(--primary-blue);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.back-btn::before {
  content: '←';
}

.secondary-btn {
  background: #F1F5F9;
  color: var(--primary-blue);
  padding: 0.9rem 1.5rem;
  border: none;
  border-radius: 18px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.95rem;
}

.notice {
  font-size: 0.85rem;
  color: #64748B;
  margin-bottom: 1.5rem;
}

.success-message {
  text-align: center;
  padding: 2rem;
}

.tracking-badge {
  display: inline-block;
  background: var(--primary-blue);
  color: white;
  padding: 0.5rem 1.2rem;
  border-radius: 20px;
  font-weight: 800;
  font-size: 1.1rem;
  margin: 1rem 0;
  letter-spacing: 1px;
  word-break: break-all;
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.6rem 1rem;
  font-weight: 700;
  color: #94A3B8;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab-btn.active {
  color: var(--primary-blue);
  border-bottom-color: var(--primary-blue);
}

.splash-loader {
  width: 40px;
  height: 3px;
  background: #f0f0f0;
  margin: 2rem auto 0;
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.splash-loader::after {
  content: '';
  position: absolute;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--primary-blue);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  to { left: 100%; }
}

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

/* Install Page Styles */
.install-page-container {
  width: 100%;
  padding: 0;
}

.install-card-main {
  background: white;
  border-radius: 32px;
  padding: 2.5rem 1.5rem;
  box-shadow: var(--card-shadow);
  text-align: center;
}

.install-options {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-top: 2rem;
}

.install-device-btn {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.2rem 1.5rem;
  border-radius: 22px;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid #E2E8F0;
  background: #F8FAFC;
  cursor: pointer;
  color: inherit;
}

.install-device-btn:hover:not(.disabled) {
  transform: translateY(-4px);
  border-color: var(--primary-blue);
  background: white;
  box-shadow: 0 12px 30px rgba(45, 91, 255, 0.1);
}

.install-device-btn.android {
  border-left: 5px solid #3DDC84;
}

.install-device-btn.ios.disabled {
  opacity: 0.6;
  cursor: default;
  filter: grayscale(1);
}

.device-icon {
  width: 56px;
  height: 56px;
  background: white;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  color: var(--text-dark);
}

.install-text {
  text-align: left;
}

.device-name {
  display: block;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-dark);
}

.action-label {
  display: block;
  font-size: 0.85rem;
  color: #64748B;
  font-weight: 600;
}

/* Mobile optimizations for Category Cards */
@media (max-width: 600px) {
  .category-card {
    padding: 1rem 0.5rem;
    border-radius: 20px;
  }
  .category-card .icon-wrapper {
    width: 50px;
    height: 50px;
    margin-bottom: 0.6rem;
    border-radius: 14px;
  }
  .category-card .icon-wrapper svg {
    width: 24px;
    height: 24px;
  }
  .category-card h3 {
    font-size: 0.8rem;
  }
  .report-form-container {
    padding: 1rem;
    border-radius: 20px;
  }
}
