/* ========================================
   AI Tools Directory - Styles
   ======================================== */

/* Language Switcher */
.lang-switch {
  display: flex;
  gap: 6px;
  margin: 14px 0;
}

.lang-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.lang-btn.active,
.lang-btn:hover {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #041010;
  border-color: transparent;
}

/* Search */
.ai-search-wrap {
  position: relative;
  margin: 16px 0;
  max-width: 560px;
}

.ai-search {
  width: 100%;
  padding: 14px 18px 14px 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--ink);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.ai-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(134,240,196,0.16);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
  display: flex;
  align-items: center;
}

/* Category Filter */
.cat-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 24px;
}

.cat-btn {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.cat-btn:hover,
.cat-btn.active {
  background: rgba(134,240,196,0.12);
  color: var(--accent);
  border-color: rgba(134,240,196,0.3);
}

/* Category Sections */
.ai-category {
  margin-top: 32px;
}

.ai-category.hidden {
  display: none;
}

.cat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.cat-icon {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(134,240,196,0.1);
  color: var(--accent);
  border: 1px solid rgba(134,240,196,0.2);
  white-space: nowrap;
}

.cat-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.cat-desc {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.cat-count {
  margin-left: auto;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(134,240,196,0.1);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.9rem;
}

/* Tools Grid */
.tools-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.tool-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  text-decoration: none;
  color: var(--ink);
  display: grid;
  gap: 10px;
  transition: all 0.25s ease;
  cursor: pointer;
}

.tool-card:hover {
  border-color: rgba(134,240,196,0.3);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(134,240,196,0.08);
}

.tool-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.tool-name {
  font-weight: 700;
  font-size: 1rem;
}

.tool-badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tool-badge.free {
  background: rgba(134,240,196,0.15);
  color: var(--accent);
}

.tool-badge.popular {
  background: rgba(124,216,255,0.15);
  color: var(--accent-2);
}

.tool-badge.new {
  background: rgba(255,200,87,0.15);
  color: #ffc857;
}

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

.tool-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tool-cat-tag {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
}

.tool-arrow {
  color: var(--accent);
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.2s;
}

.tool-card:hover .tool-arrow {
  opacity: 1;
}

/* Resume Builder CTA */
.resume-cta {
  margin-top: 40px;
}

.resume-cta-inner {
  background: linear-gradient(135deg, rgba(134,240,196,0.08), rgba(124,216,255,0.08));
  border: 1px solid rgba(134,240,196,0.2);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
}

.resume-cta-inner h2 {
  margin: 0 0 8px;
}

.resume-cta-inner p {
  color: var(--muted);
  margin: 0 0 18px;
}

/* ========================================
   AI Chat Popup
   ======================================== */

.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  transition: opacity 0.3s;
}

.chat-overlay.hidden {
  display: none;
}

.chat-popup {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  max-height: 80vh;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
  overflow: hidden;
  position: relative;
}

.chat-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.6rem;
  cursor: pointer;
  z-index: 1;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.chat-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.chat-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.chat-body {
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: 320px;
}

.chat-msg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 85%;
}

.chat-msg.bot {
  background: rgba(134,240,196,0.1);
  border: 1px solid rgba(134,240,196,0.15);
  align-self: flex-start;
}

.chat-msg.user {
  background: rgba(124,216,255,0.1);
  border: 1px solid rgba(124,216,255,0.15);
  align-self: flex-end;
}

.chat-msg p { margin: 0; }

.chat-input-wrap {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: var(--ink);
  font-size: 0.92rem;
  font-family: inherit;
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-send {
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #041010;
  font-weight: 800;
  cursor: pointer;
}

/* Subscribe Section */
.subscribe-section {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
}

.subscribe-text {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.subscribe-form {
  display: flex;
  gap: 8px;
}

.subscribe-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  color: var(--ink);
  font-size: 0.85rem;
  font-family: inherit;
}

.subscribe-input:focus {
  outline: none;
  border-color: var(--accent);
}

.subscribe-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #041010;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}

/* Chat FAB */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #041010;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(134,240,196,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.chat-fab:hover {
  transform: scale(1.08);
}

.fab-icon {
  position: relative;
  z-index: 1;
}

.fab-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: rgba(134,240,196,0.3);
  animation: fabPulse 2s ease-in-out infinite;
}

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

/* Responsive */
@media (max-width: 780px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }

  .cat-header {
    flex-wrap: wrap;
  }

  .chat-popup {
    max-height: 90vh;
  }

  .chat-fab {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
}
