/* 7D Animated Background on Body - Vibrant & Modern Theme */
body.home-active {
  background: linear-gradient(120deg, #f8fafc, #e0f2fe, #f0fdfa, #f8fafc);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100% !important;
  color: #0f172a;
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Fluid vibrant orbs behind the grid */
.home-active::before, .home-active::after {
  content: "";
  position: fixed;
  width: 70vw;
  height: 70vw;
  max-width: 500px;
  max-height: 500px;
  border-radius: 50%;
  z-index: -2;
  filter: blur(100px);
  pointer-events: none;
  animation: floatOrb 20s infinite ease-in-out alternate;
}

.home-active::before {
  top: -10%;
  left: -10%;
  background: radial-gradient(circle, rgba(0, 149, 168, 0.25) 0%, transparent 70%); /* Bright Teal */
}

.home-active::after {
  bottom: -10%;
  right: -10%;
  background: radial-gradient(circle, rgba(5, 38, 91, 0.15) 0%, transparent 70%); /* Deep Navy */
  animation-delay: -10s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, 30px) scale(1.05); }
}

/* Home Hero Section */
.home-hero {
  text-align: center;
  margin: 0px 0 40px;
  width: 100%;
  box-sizing: border-box;
}
.home-title {
  font-size: 3.5rem;
  font-weight: 800;
  color: #05265b; /* Navy */
  margin-bottom: 16px;
  letter-spacing: -1px;
  word-break: break-word;
  overflow-wrap: break-word;
}
.home-subtitle {
  font-size: 1.2rem;
  color: #475569;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* CSS Grid for Tools */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto 80px;
  position: relative;
  z-index: 10;
  width: 100%;
  box-sizing: border-box;
}

/* Glassmorphic Tool Cards - Vibrant Light */
.tool-card {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 36px 24px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.tool-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 149, 168, 0.15), 0 0 20px rgba(5, 38, 91, 0.1);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 149, 168, 0.2);
}

.tool-card-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.usage-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  padding: 3px 8px;
  border-radius: 99px;
  letter-spacing: 0.2px;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.usage-badge-header {
  font-size: 0.75rem;
  font-weight: 700;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  padding: 4px 10px;
  border-radius: 99px;
  letter-spacing: 0.2px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tool-icon {
  font-size: 2.6rem;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.1));
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tool-card:hover .tool-icon {
  transform: scale(1.15) translateY(-4px);
}

.tool-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
  letter-spacing: -0.3px;
}

.tool-card p {
  font-size: 0.95rem;
  color: #475569;
  line-height: 1.5;
  margin: 0;
}

/* Header Tweaks when Home is Active */
body.home-active .app-header {
  background: transparent;
  border-bottom: none;
  box-shadow: none;
}

/* Header Dropdown Menu Styles */
.dropdown-tool-item {
  display: flex !important;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  box-sizing: border-box;
}
.dropdown-tool-item:hover {
  background: #f1f5f9;
  color: #4f46e5;
}
.dropdown-tool-item.active {
  background: #eeeffe;
  color: #4338ca;
}

/* Restore logo colors for light theme */
body.home-active .logo span span:first-child {
  color: #05265b !important;
}
body.home-active .logo span span:nth-child(2) {
  color: #0095a8 !important; 
}
body.home-active .logo span span:last-child {
  color: #b0b0b0 !important;
}

/* --- Overscroll & Mobile Layout Fix --- */
html, body, .page-shell, #app-main-content {
  background-color: #f8fafc;
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100% !important;
  box-sizing: border-box;
}

body.home-active {
  background: linear-gradient(120deg, #f8fafc, #e0f2fe, #f0fdfa, #f8fafc) !important;
  background-size: 400% 400% !important;
  animation: gradientBG 15s ease infinite !important;
  background-attachment: fixed !important;
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100% !important;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
  .page-shell {
    padding: 10px 12px 36px !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }
  .home-title {
    font-size: 2.1rem !important;
    line-height: 1.15;
    word-break: break-word;
    overflow-wrap: break-word;
    padding: 0 12px;
  }
  .home-subtitle {
    font-size: 0.95rem;
    padding: 0 12px;
    line-height: 1.5;
  }
  .home-hero {
    margin: 20px 0 24px;
    padding: 0 12px;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .home-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
    padding: 0;
    margin-bottom: 40px;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .tool-card {
    padding: 24px 16px;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .app-header .header-container {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
  }
}

@media (max-width: 480px) {
  .header-badge a > span:nth-child(2) {
    display: none !important;
  }
  .logo span {
    font-size: 1.2rem !important;
  }
  .logo span span:last-child {
    font-size: 1rem !important;
  }
}
