/* ==========================================
   Premium Design System & Variables
   ========================================== */

:root.dark-theme {
  --bg-gradient: linear-gradient(135deg, #070a13 0%, #0f172a 100%);
  --card-bg: rgba(15, 23, 42, 0.55);
  --card-bg-hover: rgba(20, 30, 54, 0.7);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  
  --police-blue: #2563eb;
  --police-blue-rgb: 37, 99, 235;
  --police-glow: rgba(37, 99, 235, 0.25);
  
  --gold-accent: #f59e0b;
  --gold-accent-rgb: 245, 158, 11;
  --gold-glow: rgba(245, 158, 11, 0.3);
  
  --card-border: rgba(255, 255, 255, 0.06);
  --card-border-hover: rgba(255, 255, 255, 0.12);
  --shadow-main: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  --shadow-inset: inset 0 1px 1px rgba(255, 255, 255, 0.1);
  --toast-bg: rgba(30, 41, 59, 0.9);
}

:root.light-theme {
  --bg-gradient: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  --card-bg: rgba(255, 255, 255, 0.65);
  --card-bg-hover: rgba(255, 255, 255, 0.85);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-inverse: #ffffff;
  
  --police-blue: #1d4ed8;
  --police-blue-rgb: 29, 78, 216;
  --police-glow: rgba(29, 78, 216, 0.15);
  
  --gold-accent: #d97706;
  --gold-accent-rgb: 217, 119, 6;
  --gold-glow: rgba(217, 119, 6, 0.2);
  
  --card-border: rgba(15, 23, 42, 0.06);
  --card-border-hover: rgba(15, 23, 42, 0.12);
  --shadow-main: 0 25px 50px -12px rgba(15, 23, 42, 0.08);
  --shadow-inset: inset 0 1px 1px rgba(255, 255, 255, 0.4);
  --toast-bg: rgba(255, 255, 255, 0.9);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: background-color 0.4s ease, border-color 0.4s ease, color 0.2s ease;
}

body {
  font-family: 'Outfit', 'Rubik', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-x: hidden;
  position: relative;
}

/* Background Particles animation */
.particles-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.particle {
  position: absolute;
  background: radial-gradient(circle, rgba(var(--police-blue-rgb), 0.15) 0%, rgba(0,0,0,0) 70%);
  border-radius: 50%;
  animation: floatUp 25s infinite linear;
}

@keyframes floatUp {
  0% {
    transform: translateY(100vh) scale(0.5);
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(-100px) scale(1.2);
    opacity: 0;
  }
}

/* ==========================================
   Navigation and Controls
   ========================================== */

.top-nav {
  position: absolute;
  top: 20px;
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: flex-end;
  padding: 0 10px;
  z-index: 10;
}

.nav-controls {
  display: flex;
  gap: 10px;
}

.control-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-inset), 0 4px 6px -1px rgba(0,0,0,0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-btn:hover {
  background: var(--card-bg-hover);
  border-color: var(--card-border-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 0 10px var(--police-glow);
}

.control-btn i {
  font-size: 1rem;
  color: var(--police-blue);
}

/* ==========================================
   Main Card Container
   ========================================== */

.card-container {
  width: 100%;
  max-width: 480px;
  z-index: 1;
  perspective: 1000px;
}

.profile-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 32px;
  overflow: hidden;
  box-shadow: var(--shadow-inset), var(--shadow-main);
  display: flex;
  flex-direction: column;
  position: relative;
  animation: cardEntrance 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardEntrance {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Top Banner Design */
.card-banner {
  height: 90px;
  background: linear-gradient(135deg, rgba(var(--police-blue-rgb), 0.9) 0%, #0d1e3d 100%);
  position: relative;
  overflow: hidden;
}

.card-banner::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 25px;
  background: linear-gradient(to top, var(--card-bg), transparent);
}

.shine-effect {
  position: absolute;
  top: 0;
  left: -50%;
  width: 50%;
  height: 100%;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: skewX(-25deg);
  animation: shineLoop 8s infinite linear;
}

@keyframes shineLoop {
  0% { left: -50%; }
  25% { left: 125%; }
  100% { left: 125%; }
}

/* Official Logo Placement */
.logo-wrapper {
  position: absolute;
  top: 15px;
  left: 20px;
  z-index: 2;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #ffffff;
  padding: 4px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

/* Flip logo in LTR mode to right side */
html[dir="ltr"] .logo-wrapper {
  left: auto;
  right: 20px;
}

.logo-wrapper:hover {
  transform: scale(1.08) rotate(5deg);
}

#difs-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ==========================================
   Profile Header (Avatar & Info)
   ========================================== */

.profile-header {
  padding: 0 24px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -55px; /* Offset to float avatar */
  text-align: center;
  position: relative;
}

.avatar-container {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 16px;
}

.avatar-ring {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--police-blue), var(--gold-accent));
  z-index: 0;
  box-shadow: 0 0 15px var(--police-glow);
  animation: rotateRing 15s infinite linear;
}

@keyframes rotateRing {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#yael-photo {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-color);
  z-index: 1;
}

.rank-badge {
  position: absolute;
  bottom: 0;
  right: 4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold-accent);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--bg-color);
  z-index: 2;
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
  transition: transform 0.3s ease;
}

.rank-badge:hover {
  transform: scale(1.2);
}

.identity-info h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.hebrew-font {
  font-family: 'Rubik', sans-serif;
}

.rank-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--gold-accent);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.rank-divider {
  opacity: 0.5;
  font-size: 0.7rem;
}

.role-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-main);
  opacity: 0.95;
  margin-bottom: 4px;
  line-height: 1.4;
}

.dept-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.4;
}

/* ==========================================
   Action Grid (Quick Buttons)
   ========================================== */

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0 24px 24px 24px;
}

.action-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-main);
  box-shadow: var(--shadow-inset), 0 4px 6px -1px rgba(0,0,0,0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-card:hover {
  background: var(--card-bg-hover);
  border-color: var(--police-blue);
  transform: translateY(-4px);
  box-shadow: 0 12px 20px -8px rgba(var(--police-blue-rgb), 0.3), 0 0 8px var(--police-glow);
}

.icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(var(--police-blue-rgb), 0.1);
  color: var(--police-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 10px;
  transition: all 0.3s ease;
}

.action-card:hover .icon-circle {
  background: var(--police-blue);
  color: var(--text-inverse);
  transform: scale(1.05);
}

.action-card.call:hover .icon-circle {
  animation: phoneShake 0.4s ease-in-out alternate infinite;
}

@keyframes phoneShake {
  0% { transform: rotate(-10deg) scale(1.05); }
  100% { transform: rotate(10deg) scale(1.05); }
}

.action-text-main {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.action-text-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ==========================================
   Details List Section
   ========================================== */

.details-section {
  padding: 0 24px 24px 24px;
  border-top: 1px solid var(--card-border);
}

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-top: 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after {
  content: '';
  flex-grow: 1;
  height: 1px;
  background: var(--card-border);
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-item {
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.dark-theme .contact-item {
  background: rgba(255, 255, 255, 0.01);
}

.contact-item::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--police-blue);
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

/* Align accent border in Hebrew (RTL) vs English (LTR) */
html[dir="rtl"] .contact-item::before {
  right: 0;
  left: auto;
}
html[dir="ltr"] .contact-item::before {
  left: 0;
  right: auto;
}

.contact-item:hover::before {
  opacity: 1;
}

.item-icon {
  font-size: 1.1rem;
  color: var(--police-blue);
  width: 24px;
  text-align: center;
}

.item-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.item-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 2px;
  font-weight: 500;
}

.item-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  word-break: break-all;
}

.item-value:hover {
  color: var(--police-blue);
}

.copy-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: rgba(var(--police-blue-rgb), 0.1);
  color: var(--police-blue);
}

/* ==========================================
   Accordion / Info Tabs
   ========================================== */

.tabs-section {
  padding: 0 24px 24px 24px;
}

.tab-headers {
  display: flex;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 14px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  position: relative;
  flex-grow: 1;
}

.tab-btn.active {
  color: var(--police-blue);
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--police-blue);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.tab-btn.active::after {
  transform: scaleX(1);
}

.tab-content-container {
  position: relative;
}

.tab-panel {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  line-height: 1.5;
}

.tab-panel.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.tab-description {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==========================================
   Footer Badge
   ========================================== */

.card-footer {
  padding: 16px;
  background: rgba(15, 23, 42, 0.05);
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: center;
}

.dark-theme .card-footer {
  background: rgba(0, 0, 0, 0.15);
}

.footer-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.footer-badge i {
  color: var(--gold-accent);
}

/* ==========================================
   Modal Dialog (QR / Share)
   ========================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--card-bg);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--card-border);
  width: 90%;
  max-width: 400px;
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow-main);
  position: relative;
  text-align: center;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .modal-card {
  transform: scale(1) translateY(0);
}

.close-modal {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(15, 23, 42, 0.05);
  border: none;
  color: var(--text-main);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.dark-theme .close-modal {
  background: rgba(255, 255, 255, 0.05);
}

/* Flip close button direction in LTR mode */
html[dir="ltr"] .close-modal {
  left: auto;
  right: 20px;
}

.close-modal:hover {
  background: #ef4444;
  color: white;
  transform: rotate(90deg);
}

.modal-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  margin-top: 10px;
}

.modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* QR Code Container and Layout */
.qr-container {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 24px auto;
  padding: 10px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#qr-canvas-holder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#qr-canvas-holder svg {
  width: 180px !important;
  height: 180px !important;
}

.qr-logo-overlay {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.qr-logo-overlay img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Share Link Box */
.share-link-box {
  display: flex;
  gap: 8px;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 6px;
  align-items: center;
}

.dark-theme .share-link-box {
  background: rgba(255, 255, 255, 0.02);
}

#share-url-input {
  background: transparent;
  border: none;
  outline: none;
  flex-grow: 1;
  color: var(--text-main);
  font-size: 0.85rem;
  padding-inline-start: 10px;
  font-family: inherit;
}

.primary-btn {
  background: var(--police-blue);
  color: var(--text-inverse);
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.primary-btn:hover {
  background: #1d4ed8;
  box-shadow: 0 0 10px var(--police-glow);
  transform: translateY(-1px);
}

.primary-btn:active {
  transform: translateY(1px);
}

/* ==========================================
   Toast Notification Banner
   ========================================== */

.toast {
  position: fixed;
  bottom: 30px;
  background: var(--toast-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 12px 24px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 15px 30px rgba(0,0,0,0.25);
  transform: translateY(100px);
  opacity: 0;
  z-index: 1000;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

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

.toast-icon {
  color: #10b981;
  font-size: 1.1rem;
}

.toast-message {
  font-size: 0.9rem;
  font-weight: 600;
}

/* ==========================================
   Layout Tweaks for LTR (English) Mode
   ========================================== */

html[dir="ltr"] {
  /* Use Outfit font over Rubik in LTR mode */
  font-family: 'Outfit', sans-serif;
}

/* Adapt visual flow items that are side-dependent */
html[dir="ltr"] .tab-btn::after {
  /* Underlines remain centered */
}

/* Hover scales on grid buttons */
@media (max-width: 400px) {
  .action-grid {
    padding: 0 16px 16px 16px;
    gap: 8px;
  }
  .profile-header {
    padding: 0 16px 16px 16px;
  }
  .details-section {
    padding: 0 16px 16px 16px;
  }
  .tabs-section {
    padding: 0 16px 16px 16px;
  }
}
