@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --primary-gradient: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  --accent: #f97316;
  --accent-light: #fb923c;

  --bg-body: #f0f2f5;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #f1f5f9;
  --bg-tag: #e0e7ff;

  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-tag: #3730a3;

  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 40px -5px rgba(0, 0, 0, 0.1);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --sidebar-width: 260px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-body: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-input: #334155;
  --bg-tag: #312e81;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-tag: #a5b4fc;

  --border: #334155;
  --border-light: #1e293b;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.5);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 0;
  min-height: 100vh;
  transition: var(--transition);
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  overflow-y: auto;
}

.sidebar-brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand-text h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sidebar-brand-text span {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.sidebar-section {
  padding: 16px 12px 8px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 8px;
  margin-bottom: 8px;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav-item {
  margin-bottom: 2px;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
}

.sidebar-nav-link:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

.sidebar-nav-link.active {
  background: var(--primary);
  color: white;
}

.sidebar-nav-link.active:hover {
  background: var(--primary-dark);
}

.sidebar-nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-date {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-date svg {
  width: 18px;
  height: 18px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
}

.theme-toggle:hover {
  background: var(--border);
  color: var(--text-primary);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.search-section {
  padding: 20px 32px 0;
}

.search-wrapper {
  position: relative;
  max-width: 100%;
}

.search-wrapper svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.category-tabs {
  padding: 20px 32px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-tab {
  padding: 8px 18px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-secondary);
  background: var(--bg-card);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.category-tab:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  background: rgba(37, 99, 235, 0.04);
}

.category-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.apps-section {
  padding: 24px 32px 32px;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

.app-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
  opacity: 0;
  transition: var(--transition);
}

.app-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-light);
}

.app-card:hover::before {
  opacity: 1;
}

.app-card-bg-logo {
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 140px;
  height: 140px;
  opacity: 0;
  transform: scale(0.8) rotate(-10deg);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
  pointer-events: none;
  filter: grayscale(100%);
}

.app-card-bg-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.08;
}

.app-card-bg-logo svg {
  width: 100%;
  height: 100%;
  color: var(--primary);
  opacity: 0.05;
}

[data-theme="dark"] .app-card-bg-logo img {
  opacity: 0.15;
}

[data-theme="dark"] .app-card-bg-logo svg {
  opacity: 0.1;
}

.app-card:hover .app-card-bg-logo {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.app-card-icon {
  display: flex;
  align-items: center;
  margin-bottom: 18px;
  flex-shrink: 0;
  height: 52px;
}

.app-card-icon img {
  height: 100%;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}

.app-card-icon svg {
  width: 44px;
  height: 44px;
  color: var(--primary);
}

.app-card-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.app-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.app-card-tags span {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--bg-tag);
  color: var(--text-tag);
  font-size: 11px;
  font-weight: 600;
  border-radius: 100px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.app-card-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 6px;
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-results svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.no-results h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.no-results p {
  font-size: 14px;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-card {
  animation: fadeInUp 0.4s ease forwards;
}

.app-card:nth-child(1) {
  animation-delay: 0.05s;
}

.app-card:nth-child(2) {
  animation-delay: 0.1s;
}

.app-card:nth-child(3) {
  animation-delay: 0.15s;
}

.app-card:nth-child(4) {
  animation-delay: 0.2s;
}

.app-card:nth-child(5) {
  animation-delay: 0.25s;
}

.app-card:nth-child(6) {
  animation-delay: 0.3s;
}

.app-card:nth-child(7) {
  animation-delay: 0.35s;
}

.app-card:nth-child(8) {
  animation-delay: 0.4s;
}

.sidebar-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: flex;
  }

  .top-header {
    padding: 12px 16px;
  }

  .search-section,
  .category-tabs,
  .apps-section {
    padding-left: 16px;
    padding-right: 16px;
  }

  .apps-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
  }

  .app-card {
    padding: 18px;
  }
}

@media (max-width: 480px) {
  .apps-grid {
    grid-template-columns: 1fr;
  }

  .app-card-icon {
    height: 52px;
    margin-bottom: 12px;
    margin-left: -6px;
  }

  .app-card-icon img {
    max-width: 140px;
  }
}