/* ==========================================================================
   ApliHub Design System & Stylesheet
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');
@import url('./animations.css');

:root {
  --bg-main: #090d16;
  --bg-secondary: #0f172a;
  --bg-card: rgba(23, 32, 54, 0.65);
  --bg-card-hover: rgba(30, 42, 69, 0.85);
  --bg-glass: rgba(13, 19, 33, 0.75);
  --bg-dropdown: #111827;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(245, 158, 11, 0.35);
  --border-active: #f59e0b;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-primary: #f59e0b;
  --accent-hover: #d97706;
  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 30px rgba(245, 158, 11, 0.2);
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 60%, rgba(139, 92, 246, 0.07) 0%, transparent 45%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font-family: inherit;
  color: inherit;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 16px 0;
}

.nav-wrapper {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.brand {
  justify-self: start;
}

.nav-menu {
  justify-self: center;
}

.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-container {
  position: relative;
}

/* Brand Logo */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.25) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.35);
  transition: var(--transition);
}

.brand:hover .brand-icon {
  transform: scale(1.1) rotate(-4deg);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.7);
  border-color: #fbbf24;
}

.brand-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.8));
  animation: logoBouncePulse 4s ease-in-out infinite;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #ffffff, #f59e0b, #fbbf24, #ffffff);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: logoShimmer 4s linear infinite;
  text-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

/* Main Navigation Links */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.6);
  padding: 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.nav-item {
  padding: 8px 20px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  user-select: none;
  border: 1px solid transparent;
}

.nav-item:hover {
  color: var(--text-main);
}

.nav-item.active {
  color: #ffffff;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: var(--accent-primary);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--accent-primary);
}

/* Profile Section Right */
.profile-container {
  position: relative;
}

.btn-profile-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px 6px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

.btn-profile-trigger:hover {
  border-color: var(--border-glow);
  background: rgba(30, 41, 59, 0.9);
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d97706, #f59e0b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: #000;
  overflow: hidden;
}

.avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.caret-icon {
  width: 14px;
  height: 14px;
  fill: var(--text-muted);
  transition: var(--transition);
}

.profile-container.open .caret-icon {
  transform: rotate(180deg);
}

/* Dropdown Menu */
.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  width: 220px;
  background: var(--bg-dropdown);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 120;
}

.profile-container.open .profile-dropdown {
  display: block;
  animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.dropdown-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 6px;
}

.dropdown-user-name {
  font-weight: 700;
  font-size: 0.92rem;
}

.dropdown-user-email {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 6px 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.dropdown-item svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.dropdown-item:hover {
  color: var(--text-main);
  background: rgba(245, 158, 11, 0.12);
}

.dropdown-logout {
  color: #f87171;
}

.dropdown-logout:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #ef4444 !important;
}

/* Custom Switch Toggle */
.switch-toggle input:checked + .slider-round {
  background-color: #f59e0b !important;
}

.switch-toggle input:checked + .slider-round::before {
  transform: translateX(20px);
}

.slider-round::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */

.hero-section {
  padding: 60px 0 50px 0;
  position: relative;
}

.hero-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-full);
  color: var(--accent-primary);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.hero-tag .dot {
  width: 8px;
  height: 8px;
  background: var(--accent-primary);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-primary);
}

.hero-title {
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 18px;
  text-transform: uppercase;
  background: linear-gradient(180deg, #ffffff 40%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 540px;
  margin-bottom: 30px;
}

/* Search Box */
.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
}

.search-input {
  width: 100%;
  padding: 16px 20px 16px 48px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.25);
  background: rgba(15, 23, 42, 0.95);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  fill: var(--text-dim);
  pointer-events: none;
}

/* Hero Media / Graphic */
.hero-media {
  position: relative;
  display: flex;
  justify-content: center;
}

.hero-image-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.hero-image-card img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  border-radius: var(--radius-lg);
}

/* ==========================================================================
   Main Content Layout & Glowing Cards
   ========================================================================== */

.content-section {
  padding: 40px 0 80px 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 12px;
}

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

/* Tool Grid (Apps & Plugins) & Glowing Border Animation */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
}

.card,
.glowing-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
  overflow: hidden;
}

.card::before,
.glowing-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--radius-md) + 2px);
  padding: 2px;
  background: conic-gradient(from var(--border-angle, 0deg), #f59e0b, #fbbf24, rgba(245, 158, 11, 0.2), transparent 45%, #f59e0b);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.card:hover::before,
.glowing-card:hover::before {
  opacity: 1;
  animation: spinBorder 2.2s linear infinite;
}

.card:hover,
.glowing-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.22), 0 0 12px rgba(245, 158, 11, 0.12);
  background: var(--bg-card-hover);
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 10px;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.card-info {
  flex: 1;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.card-badge {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.card-stats {
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  gap: 10px;
}

.btn-download {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--accent-primary);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
}

.btn-download:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.5);
}

/* News Cards (Aktualności) */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  transition: var(--transition);
}

.news-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-3px);
}

.news-date {
  font-size: 0.78rem;
  color: var(--accent-primary);
  font-weight: 700;
  margin-bottom: 6px;
}

.news-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.news-content {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Important Grid (Ważne) */
.important-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.important-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.important-icon {
  width: 40px;
  height: 40px;
  background: rgba(245, 158, 11, 0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.important-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

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

/* ==========================================================================
   Modals & Overlays
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
  animation: backdropFade 0.25s forwards;
}

.modal-box {
  background: var(--bg-dropdown);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  padding: 28px;
  position: relative;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.btn-close-modal {
  position: absolute;
  right: 20px;
  top: 20px;
  z-index: 10;
  pointer-events: auto;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: var(--transition);
}

.btn-close-modal:hover {
  color: #fff;
  transform: scale(1.15);
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 36px;
}

/* Toast Notification - Ukryte zgodnie z punktem 4 */
.toast-container,
#toastContainer,
.toast {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
  }

  .hero-content {
    align-items: center;
  }

  .hero-title {
    font-size: 2.4rem;
  }

  .nav-menu {
    gap: 4px;
  }

  .nav-item {
    padding: 6px 12px;
    font-size: 0.85rem;
  }
}

/* ==========================================================================
   Apli Pro Premium Button & Gated Download Styles
   ========================================================================== */
.btn-apli-pro {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 20px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 40%, #7c3aed 100%);
  background-size: 200% 200%;
  border: 1px solid rgba(245, 158, 11, 0.6);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: apliProShimmer 4s ease infinite;
}

.btn-apli-pro:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.6), 0 0 12px rgba(124, 58, 237, 0.4);
  border-color: rgba(255, 255, 255, 0.9);
}

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

.btn-apli-pro .pro-crown {
  font-size: 0.95rem;
  filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.8));
}

.btn-download-restricted {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #64748b !important;
  cursor: not-allowed !important;
  opacity: 0.6;
}

/* ==========================================================================
   APP TEST SANDBOX & LAUNCH MODAL (TRYB TESTOWY BEZ POBIERANIA)
   ========================================================================== */
.btn-test-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-test-live:hover {
  background: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  border-color: #3b82f6;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

.app-test-sandbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #070a12;
  z-index: 999999;
  display: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.app-test-sandbox.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.app-test-sandbox iframe {
  width: 100vw;
  height: 100vh;
  border: none;
  display: block;
}



.sandbox-frame-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
}
