/* styles.css - Main Layout and Components */

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

img, svg {
  max-width: 100%;
  display: block;
}

input, button, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

/* Utilities */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}

.section-padding {
  padding: 64px 0;
}

/* Header & Navigation */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 22px;
  color: var(--brand-primary);
}

.logo svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.nav-link {
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
  padding: 8px 0;
}

.nav-link:hover, .nav-link.active {
  color: var(--brand-primary);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--brand-primary);
  transition: width var(--transition-normal);
}

.nav-link:hover::after, .nav-link.active::after {
  width: 100%;
}

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

.theme-toggle-btn, .search-toggle-btn, .mobile-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover, .search-toggle-btn:hover, .mobile-toggle-btn:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--border-hover);
  color: var(--brand-primary);
}

.theme-toggle-btn svg, .search-toggle-btn svg, .mobile-toggle-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.theme-toggle-btn .sun-icon {
  display: none;
}

[data-theme="dark"] .theme-toggle-btn .sun-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle-btn .moon-icon {
  display: none;
}

.mobile-toggle-btn {
  display: none;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 80px 0 60px;
  position: relative;
  overflow: hidden;
}

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  background-color: var(--brand-light);
  color: var(--brand-primary);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.hero p {
  font-size: 20px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 36px;
}

/* Search Bar */
.search-wrapper {
  max-width: 580px;
  margin: 0 auto;
  position: relative;
}

.search-input-container {
  display: flex;
  align-items: center;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 8px 16px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
}

.search-input-container:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px var(--brand-light);
}

.search-input-container svg {
  width: 20px;
  height: 20px;
  fill: var(--text-muted);
  margin-right: 12px;
}

.search-input {
  width: 100%;
  padding: 10px 0;
  font-size: 16px;
}

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

/* Categories & Tools Grid */
.categories-container {
  margin-bottom: 32px;
}

.category-tags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 48px;
  list-style: none;
}

.category-tag-btn {
  padding: 8px 20px;
  border-radius: var(--radius-full);
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.category-tag-btn:hover, .category-tag-btn.active {
  background-color: var(--brand-primary);
  color: #ffffff;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.tool-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-slow);
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background-color: var(--brand-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-normal);
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.tool-card:hover::before {
  transform: scaleX(1);
}

.tool-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background-color: var(--brand-light);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  transition: background-color var(--transition-normal);
}

[data-theme="dark"] .tool-icon-wrapper {
  background-color: rgba(99, 102, 241, 0.1);
}

.tool-icon-wrapper svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.tool-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.tool-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  flex-grow: 1;
}

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

.tool-category-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.tool-action-link {
  font-weight: 600;
  font-size: 14px;
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.tool-action-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  transition: transform var(--transition-fast);
}

.tool-card:hover .tool-action-link svg {
  transform: translateX(4px);
}

/* Forms & General Inputs */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-light);
}

textarea.form-control {
  resize: vertical;
  min-height: 120px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--brand-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--brand-hover);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  filter: brightness(0.9);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Legal & Text Layouts */
.legal-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 24px;
}

.legal-container h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 24px;
}

.legal-container h2 {
  font-size: 22px;
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 16px;
}

.legal-container p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.legal-container ul {
  margin-bottom: 16px;
  padding-left: 20px;
  color: var(--text-secondary);
}

.legal-container li {
  margin-bottom: 8px;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 380px;
  width: 100%;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background-color: var(--bg-secondary);
  border-left: 4px solid var(--brand-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  animation: slideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  color: var(--text-primary);
  font-weight: 500;
}

.toast-success {
  border-left-color: var(--success);
}

.toast-warning {
  border-left-color: var(--warning);
}

.toast-error {
  border-left-color: var(--danger);
}

@keyframes slideIn {
  to { transform: translateX(0); }
}

.toast.fade-out {
  animation: slideOut 0.3s ease forwards;
}

@keyframes slideOut {
  to { transform: translateX(120%); opacity: 0; }
}

/* Cookie Banner */
.cookie-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: 24px;
  max-width: 500px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  z-index: 999;
  transform: translateY(150%);
  transition: transform var(--transition-slow);
}

.cookie-banner.show {
  transform: translateY(0);
}

.cookie-banner h4 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.cookie-banner p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.cookie-banner-actions {
  display: flex;
  gap: 12px;
}

.cookie-banner-actions .btn {
  flex: 1;
  padding: 10px 16px;
  font-size: 14px;
}

/* Footer */
footer {
  margin-top: auto;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 64px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.2fr;
  gap: 48px;
  margin-bottom: 48px;
}

.footer-column h4 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-column p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 12px;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 14px;
}

.footer-links a:hover {
  color: var(--brand-primary);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Mobile Nav Drawer */
.mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: var(--bg-secondary);
  z-index: 150;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--transition-slow);
}

.mobile-nav.open {
  transform: translateX(0);
}

.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 48px;
}

.mobile-menu-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.mobile-menu-link {
  font-size: 20px;
  font-weight: 600;
}

/* Responsive Rules */
@media (max-width: 992px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
}

@media (max-width: 768px) {
  .nav-menu {
    display: none;
  }
  
  .mobile-toggle-btn {
    display: flex;
  }
  
  .hero h1 {
    font-size: 36px;
  }
  
  .hero p {
    font-size: 16px;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
  
  .cookie-banner {
    bottom: 12px;
    left: 12px;
    right: 12px;
    padding: 16px;
  }
  
  .cookie-banner-actions {
    flex-direction: column;
  }
}
