@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap");

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

:root {
  --primary-color: #25d366;
  --primary-dark: #128c7e;
  --primary-light: #4ade80;
  --secondary-color: #075e54;
  --accent-color: #dcf8c6;
  --neon-green: #00ff88;
  --neon-blue: #00d4ff;
  --neon-purple: #b026ff;
  --text-dark: #0a0a0a;
  --text-light: #6b7280;
  --text-white: #ffffff;
  --bg-dark: #0a0a0f;
  --bg-glass: rgba(255, 255, 255, 0.05);
  --bg-glass-light: rgba(255, 255, 255, 0.1);
  --border-glass: rgba(255, 255, 255, 0.2);
  --shadow-neon: 0 0 20px rgba(37, 211, 102, 0.3);
  --shadow-neon-strong: 0 0 40px rgba(37, 211, 102, 0.5);
  --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-dark);
  min-height: 100vh;
  color: var(--text-white);
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 0;
  margin: 0;
}

/* Desktop - Different background outside mobile view */
@media (min-width: 769px) {
  body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 25%, #0f3460 50%, #16213e 75%, #1a1a2e 100%);
  }

  body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, #1a1a2e 0%, #1a1a2e calc(50% - 214px), transparent calc(50% - 214px), transparent calc(50% + 214px), #1a1a2e calc(50% + 214px), #1a1a2e 100%);
    z-index: 0;
    pointer-events: none;
  }

  body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 30%, rgba(37, 211, 102, 0.15) 0%, transparent 50%), radial-gradient(circle at 80% 70%, rgba(0, 212, 255, 0.15) 0%, transparent 50%), radial-gradient(circle at 50% 50%, rgba(176, 38, 255, 0.1) 0%, transparent 50%), repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.02) 0px, transparent 1px, transparent 2px, rgba(255, 255, 255, 0.02) 3px);
    mask: linear-gradient(90deg, black 0%, black calc(50% - 214px), transparent calc(50% - 214px), transparent calc(50% + 214px), black calc(50% + 214px), black 100%);
    -webkit-mask: linear-gradient(90deg, black 0%, black calc(50% - 214px), transparent calc(50% - 214px), transparent calc(50% + 214px), black calc(50% + 214px), black 100%);
    z-index: 0;
    pointer-events: none;
  }

  .animated-bg {
    z-index: -1;
  }
}

/* Animated Background */
.animated-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #16213e 100%);
  overflow: hidden;
}

.particles {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--primary-color);
  border-radius: 50%;
  opacity: 0.6;
  animation: float 20s infinite;
  box-shadow: 0 0 10px var(--primary-color);
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-100vh) translateX(100px);
    opacity: 0;
  }
}

.gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: orbFloat 20s ease-in-out infinite;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--neon-green) 0%, transparent 70%);
  top: -200px;
  left: -200px;
  animation-delay: 0s;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--neon-blue) 0%, transparent 70%);
  bottom: -150px;
  right: -150px;
  animation-delay: 7s;
}

.orb-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, var(--neon-purple) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: 14s;
}

@keyframes orbFloat {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(50px, 50px) scale(1.1);
  }
  66% {
    transform: translate(-50px, -50px) scale(0.9);
  }
}

/* Notification */
.notification {
  position: fixed;
  top: 15px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text-white);
  font-weight: 500;
  font-size: 13px;
  box-shadow: var(--shadow-glass);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 1000;
  width: auto;
  min-width: 200px;
  max-width: calc(100% - 30px);
  text-align: center;
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.3;
}

.notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.notification.success {
  background: rgba(39, 174, 96, 0.2);
  border-color: rgba(39, 174, 96, 0.5);
}

.notification.error {
  background: rgba(231, 76, 60, 0.2);
  border-color: rgba(231, 76, 60, 0.5);
}

.notification.info {
  background: rgba(37, 211, 102, 0.2);
  border-color: rgba(37, 211, 102, 0.5);
}

/* Universal Connection Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.show {
  display: flex;
  opacity: 1;
}

.modal-overlay.closing {
  display: flex !important;
  opacity: 1;
}

.modal-content {
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.15) 0%, rgba(18, 140, 126, 0.15) 50%, rgba(7, 94, 84, 0.2) 100%);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: none;
  border-top: 1px solid rgba(37, 211, 102, 0.3);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  box-shadow: 0 -10px 40px rgba(37, 211, 102, 0.3);
}

.modal-overlay.show .modal-content {
  animation: slideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.modal-overlay.closing .modal-content {
  animation: slideDown 0.3s cubic-bezier(0.55, 0.06, 0.68, 0.19) forwards;
}

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

@keyframes slideDown {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(100%);
    opacity: 0;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-glass);
  position: relative;
}

.modal-header::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: -0.5px;
}

.modal-close {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-white);
  cursor: pointer;
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.modal-close i {
  font-size: 16px;
}

.modal-close:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(0.95);
}

.modal-body {
  padding: 20px;
  flex: 1;
  overflow: visible;
}

.modal-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-label i {
  color: var(--primary-color);
  font-size: 14px;
}

.phone-section {
  margin-bottom: 18px;
}

.phone-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.country-code {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid var(--border-glass);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-white);
  min-width: 60px;
  text-align: center;
}

.phone-input {
  flex: 1;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid var(--border-glass);
  border-radius: 12px;
  font-size: 15px;
  color: var(--text-white);
  transition: all 0.3s ease;
  -webkit-appearance: none;
  appearance: none;
}

.phone-input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.08);
}

.code-section {
  margin-bottom: 18px;
  display: block;
}

.code-inputs {
  display: grid;
  grid-template-columns: repeat(4, 1fr) auto repeat(4, 1fr);
  gap: 8px;
  align-items: center;
}

.code-input {
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid var(--border-glass);
  border-radius: 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-white);
  text-align: center;
  transition: all 0.3s ease;
  -webkit-appearance: none;
  appearance: none;
}

.code-input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.code-input[readonly] {
  background: rgba(37, 211, 102, 0.1);
  border-color: var(--primary-color);
  cursor: default;
  color: var(--primary-color);
  font-weight: 700;
}

.code-dash {
  color: rgba(255, 255, 255, 0.5);
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.copy-code-btn {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
  margin-top: 10px;
  -webkit-tap-highlight-color: transparent;
}

.copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary-color);
}

.copy-code-btn:active {
  transform: scale(0.98);
}

.copy-code-btn i {
  font-size: 12px;
}

.tutorial-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 18px;
  display: block;
}

.tutorial-section h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-white);
  margin-bottom: 12px;
}

.tutorial-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tutorial-content p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
  margin: 0;
}

.tutorial-content strong {
  color: var(--primary-color);
  font-weight: 600;
}

.connect-modal-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: var(--text-white);
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-neon);
  touch-action: manipulation;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
  margin-bottom: 18px;
  margin-top: 0;
}

.connect-modal-btn:active {
  transform: scale(0.98);
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 428px;
  background: linear-gradient(135deg, rgba(25, 150, 135, 0.4) 0%, rgba(15, 110, 100, 0.4) 100%);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-top: 1px solid rgba(37, 211, 102, 0.25);
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding: 8px 0;
  z-index: 999;
  box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.4), 0 0 30px rgba(37, 211, 102, 0.15);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.5);
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  min-width: 50px;
  flex: 1;
}

.nav-item i {
  font-size: 20px;
  transition: all 0.3s ease;
}

.nav-item[href="profile.html"] i {
  font-weight: 300;
}

.nav-item span {
  font-size: 9px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

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

.nav-item:active {
  transform: scale(0.95);
}

/* Scan Button (Center, Half Outside Footer) */
.scan-btn {
  position: relative;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  border: 3px solid rgba(37, 211, 102, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4), 0 0 30px rgba(37, 211, 102, 0.3);
  transition: all 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  z-index: 1000;
  margin-top: -32px;
  flex-shrink: 0;
}

.scan-btn::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  opacity: 0.3;
  z-index: -1;
  animation: pulse-ring 2s ease-out infinite;
}

.scan-btn::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  opacity: 0.2;
  z-index: -2;
  animation: pulse-ring 2s ease-out infinite 0.5s;
}

.scan-btn i {
  font-size: 28px;
  color: var(--text-white);
  z-index: 1;
  animation: scan-icon 2s ease-in-out infinite;
}

.scan-btn:active {
  transform: scale(0.9);
  box-shadow: 0 2px 10px rgba(37, 211, 102, 0.5);
}

@keyframes pulse-ring {
  0% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.1;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

@keyframes scan-icon {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.1) rotate(5deg);
  }
}

/* Tablet and Desktop */
@media (min-width: 769px) {
  .notification {
    top: 20px;
    right: 20px;
    left: auto;
    width: auto;
    min-width: 200px;
    max-width: 90%;
    padding: 10px 14px;
    font-size: 13px;
    text-align: left;
    transform: translateX(400px);
  }

  .notification.show {
    transform: translateX(0);
  }

  .nav-item:hover {
    color: rgba(255, 255, 255, 0.8);
  }

  .scan-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 6px 30px rgba(37, 211, 102, 0.5), 0 0 40px rgba(37, 211, 102, 0.4);
  }
}

/* Full Page Loader */
.full-page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 15, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.full-page-loader.show {
  display: flex;
  opacity: 1;
}

.loader-content {
  text-align: center;
  color: var(--text-white);
  padding: 20px;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(37, 211, 102, 0.2);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 12px;
}

.loader-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-white);
  margin-top: 0;
  letter-spacing: 0.3px;
}

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