/* ===== CSS Variables ===== */
:root {
  --bg-primary: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --primary: #6366f1;
  --secondary: #ec4899;
  --accent: #f59e0b;
  --muted: #94a3b8;

  /* App Gradients */
  --hr-gradient: linear-gradient(135deg, #f472b6 0%, #db2777 100%);
  --invoice-gradient: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  --reconcile-gradient: linear-gradient(135deg, #fcd34d 0%, #f59e0b 100%);
  --accounting-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);
  --inventory-gradient: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  --crm-gradient: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
  --project-gradient: linear-gradient(135deg, #4ade80 0%, #16a34a 100%);
  --reports-gradient: linear-gradient(135deg, #c084fc 0%, #9333ea 100%);

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Outfit", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ===== Animated Background ===== */
.bg-mesh {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(at 80% 20%, rgba(236, 72, 153, 0.12) 0%, transparent 50%),
    radial-gradient(at 40% 80%, rgba(245, 158, 11, 0.1) 0%, transparent 50%),
    radial-gradient(at 90% 90%, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
  z-index: -2;
  animation: meshMove 20s ease-in-out infinite;
}

@keyframes meshMove {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.05) rotate(1deg);
  }
}

/* Floating Shapes */
.floating-shapes {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.4;
  animation: float 15s ease-in-out infinite;
}

.shape-1 {
  width: 300px;
  height: 300px;
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.3),
    rgba(236, 72, 153, 0.2)
  );
  top: -100px;
  right: -100px;
  animation-delay: 0s;
}

.shape-2 {
  width: 200px;
  height: 200px;
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.3),
    rgba(236, 72, 153, 0.2)
  );
  bottom: 20%;
  left: -50px;
  animation-delay: -5s;
}

.shape-3 {
  width: 150px;
  height: 150px;
  background: linear-gradient(
    135deg,
    rgba(52, 211, 153, 0.3),
    rgba(99, 102, 241, 0.2)
  );
  top: 40%;
  right: 10%;
  animation-delay: -10s;
}

.shape-4 {
  width: 100px;
  height: 100px;
  background: linear-gradient(
    135deg,
    rgba(236, 72, 153, 0.3),
    rgba(245, 158, 11, 0.2)
  );
  bottom: 10%;
  right: 30%;
  animation-delay: -7s;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-20px) rotate(5deg);
  }
  50% {
    transform: translateY(0) rotate(0deg);
  }
  75% {
    transform: translateY(20px) rotate(-5deg);
  }
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.logo-text {
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.search-container {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.9rem;
}

.search-bar {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: rgba(241, 245, 249, 0.8);
  border: 2px solid transparent;
  border-radius: 50px;
  font-family: "Outfit", sans-serif;
  font-size: 0.95rem;
  color: var(--text-primary);
  transition: all 0.3s ease;
  outline: none;
}

.search-bar:focus {
  background: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.search-bar::placeholder {
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.notification-btn {
  position: relative;
  width: 42px;
  height: 42px;
  background: rgba(241, 245, 249, 0.8);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.notification-btn:hover {
  background: white;
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: var(--secondary);
  border-radius: 50%;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  background: linear-gradient(135deg, var(--primary), var(--secondary))
    border-box;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.user-avatar:hover {
  transform: scale(1.05);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== Main Content ===== */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 100px 2rem 4rem;
}

/* Welcome Section */
.welcome-section {
  text-align: center;
  margin-bottom: 3rem;
  animation: fadeInUp 0.6s ease-out;
}

.welcome-title {
  font-family: "Nunito", sans-serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.wave {
  display: inline-block;
  animation: wave 2s ease-in-out infinite;
  transform-origin: 70% 70%;
}

@keyframes wave {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(20deg);
  }
  75% {
    transform: rotate(-10deg);
  }
}

.welcome-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

/* Section Titles */
.section-title {
  font-family: "Nunito", sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title i {
  color: var(--primary);
}

/* ===== Apps Grid ===== */
.apps-section {
  margin-bottom: 4rem;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
}

.app-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
  padding: 1.5rem;
}

.app-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 24px;
  padding: 2px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.5),
    rgba(255, 255, 255, 0.1)
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.app-glow {
  position: absolute;
  width: 150%;
  height: 150%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.4s ease;
  filter: blur(40px);
}

.app-tile:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.app-tile:hover .app-glow {
  opacity: 0.4;
}

/* App-specific styles */
.hr-app {
  background: var(--hr-gradient);
}
.hr-app .app-glow {
  background: #f472b6;
}

.invoice-app {
  background: var(--invoice-gradient);
}
.invoice-app .app-glow {
  background: #a78bfa;
}

.reconcile-app {
  background: var(--reconcile-gradient);
}
.reconcile-app .app-glow {
  background: #fcd34d;
}

.accounting-app {
  background: var(--accounting-gradient);
}
.accounting-app .app-glow {
  background: #34d399;
}

.inventory-app {
  background: var(--inventory-gradient);
}
.inventory-app .app-glow {
  background: #38bdf8;
}

.crm-app {
  background: var(--crm-gradient);
}
.crm-app .app-glow {
  background: #fb923c;
}

.project-app {
  background: var(--project-gradient);
}
.project-app .app-glow {
  background: #4ade80;
}

.reports-app {
  background: var(--reports-gradient);
}
.reports-app .app-glow {
  background: #c084fc;
}

.app-icon-wrapper {
  width: 70px;
  height: 70px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.app-tile:hover .app-icon-wrapper {
  transform: scale(1.1) rotate(5deg);
}

.app-label {
  font-family: "Nunito", sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.app-description {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 4px;
}

.app-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
}

/* ===== Stats Section ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
  animation: fadeInUp 0.6s ease-out;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.3rem;
}

.stat-icon.employees {
  background: var(--hr-gradient);
}
.stat-icon.invoices {
  background: var(--invoice-gradient);
}
.stat-icon.pending {
  background: var(--reconcile-gradient);
}
.stat-icon.growth {
  background: var(--accounting-gradient);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: "Nunito", sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.heart {
  display: inline-block;
  animation: heartbeat 1.5s ease-in-out infinite;
}

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

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

/* Stagger animations for app tiles */
.app-tile:nth-child(1) {
  animation: fadeInUp 0.5s ease-out 0.1s both;
}
.app-tile:nth-child(2) {
  animation: fadeInUp 0.5s ease-out 0.15s both;
}
.app-tile:nth-child(3) {
  animation: fadeInUp 0.5s ease-out 0.2s both;
}
.app-tile:nth-child(4) {
  animation: fadeInUp 0.5s ease-out 0.25s both;
}
.app-tile:nth-child(5) {
  animation: fadeInUp 0.5s ease-out 0.3s both;
}
.app-tile:nth-child(6) {
  animation: fadeInUp 0.5s ease-out 0.35s both;
}
.app-tile:nth-child(7) {
  animation: fadeInUp 0.5s ease-out 0.4s both;
}
.app-tile:nth-child(8) {
  animation: fadeInUp 0.5s ease-out 0.45s both;
}

.stat-card:nth-child(1) {
  animation-delay: 0.5s;
}
.stat-card:nth-child(2) {
  animation-delay: 0.55s;
}
.stat-card:nth-child(3) {
  animation-delay: 0.6s;
}
.stat-card:nth-child(4) {
  animation-delay: 0.65s;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header {
    padding: 0 1rem;
  }

  .search-container {
    display: none;
  }

  .logo-text {
    font-size: 1.2rem;
  }

  .main-content {
    padding: 90px 1rem 3rem;
  }

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

  .app-tile {
    padding: 1rem;
  }

  .app-icon-wrapper {
    width: 56px;
    height: 56px;
    font-size: 1.4rem;
  }

  .app-label {
    font-size: 1rem;
  }

  .app-description {
    display: none;
  }

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

  .stat-card {
    flex-direction: column;
    text-align: center;
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .welcome-title {
    font-size: 1.8rem;
  }

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

  .stat-card {
    flex-direction: row;
    text-align: left;
  }
}

/* ===== Dark Mode (Optional - based on system preference) ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(71, 85, 105, 0.3);
  }

  .search-bar {
    background: rgba(30, 41, 59, 0.8);
    color: var(--text-primary);
  }

  .search-bar:focus {
    background: rgba(30, 41, 59, 1);
  }

  .notification-btn {
    background: rgba(30, 41, 59, 0.8);
    color: var(--text-secondary);
  }

  .notification-btn:hover {
    background: rgba(51, 65, 85, 1);
  }
}

a {
  text-decoration: none;
}

.app-tile-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
