/* ============================================
   بسهالة - bsahala.com
   Design System & Main Styles
   ============================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&family=Cairo:wght@300;400;500;600;700&display=swap');

/* ---- CSS Variables (Light Mode Default) ---- */
:root {
  /* Colors */
  --bg-primary: #f0f4ff;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-glass: rgba(255, 255, 255, 0.6);
  --bg-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-hero-overlay: rgba(255, 255, 255, 0.05);

  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #7a7a9a;
  --text-on-gradient: #ffffff;

  --accent-primary: #ef4444;       /* Red 500 */
  --accent-secondary: #e11d48;     /* Rose 600 */
  --accent-gradient: linear-gradient(135deg, #ef4444, #e11d48);
  --accent-green: #10b981;
  --accent-green-light: #d1fae5;
  --accent-blue: #3b82f6;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --accent-pink: #ec4899;
  --accent-teal: #14b8a6;

  --border-color: rgba(99, 102, 241, 0.15);
  --border-light: rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);

  /* Typography */
  --font-heading: 'Tajawal', sans-serif;
  --font-body: 'Cairo', sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 50%;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Container */
  --container-max: 1200px;
  --header-height: 70px;
}

/* ---- Dark Mode ---- */
[data-theme="dark"] {
  --bg-primary: #0a0e27;
  --bg-secondary: #121638;
  --bg-card: rgba(26, 31, 78, 0.7);
  --bg-card-hover: rgba(36, 41, 98, 0.85);
  --bg-glass: rgba(18, 22, 56, 0.7);
  --bg-hero: linear-gradient(135deg, #1a1f4e 0%, #0a0e27 100%);
  --bg-hero-overlay: rgba(99, 102, 241, 0.05);

  --text-primary: #e8e8f0;
  --text-secondary: #b0b0d0;
  --text-muted: #7878a0;

  --border-color: rgba(99, 102, 241, 0.2);
  --border-light: rgba(255, 255, 255, 0.06);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.25);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  text-align: right;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition-normal), color var(--transition-normal);
}

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

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
}

button, input, select, textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  border: none;
  outline: none;
}

/* ---- Utilities ---- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.section {
  padding: var(--space-3xl) 0;
}

.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Header ---- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
  z-index: 1000;
  transition: all var(--transition-normal);
}

.header.scrolled {
  box-shadow: var(--shadow-md);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.nav-links a {
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
  padding: var(--space-xs) 0;
  transition: color var(--transition-fast);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent-primary);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: 0;
  width: 0;
  height: 2px;
  background: var(--accent-gradient);
  border-radius: 2px;
  transition: width var(--transition-normal);
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.theme-toggle {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--accent-primary);
  transform: rotate(15deg);
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.mobile-menu-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

.mobile-menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ---- Hero Section ---- */
.hero {
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hero);
  position: relative;
  overflow: hidden;
  margin-top: var(--header-height);
  padding: var(--space-3xl) 0;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  animation: float 8s ease-in-out infinite;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, transparent 70%);
  border-radius: 50%;
  animation: float 10s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, -30px); }
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-xl);
  color: var(--text-on-gradient);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: var(--space-lg);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 900;
  color: var(--text-on-gradient);
  margin-bottom: var(--space-md);
  line-height: 1.3;
}

.hero p {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: var(--space-xl);
  line-height: 1.8;
}

/* Search Box */
.search-box {
  position: relative;
  max-width: 500px;
  margin: 0 auto;
}

.search-box input {
  width: 100%;
  padding: var(--space-md) var(--space-xl);
  padding-right: 3.5rem;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-primary);
  font-size: 1rem;
  box-shadow: var(--shadow-lg);
  border: 2px solid transparent;
  transition: all var(--transition-fast);
}

[data-theme="dark"] .search-box input {
  background: rgba(18, 22, 56, 0.9);
  color: var(--text-primary);
}

.search-box input:focus {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
}

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

.search-box .search-icon {
  position: absolute;
  right: var(--space-lg);
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-primary);
  font-size: 1.2rem;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 300px;
  overflow-y: auto;
  z-index: 10;
  display: none;
  border: 1px solid var(--border-light);
}

.search-results.active {
  display: block;
}

.search-results a {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-light);
}

.search-results a:last-child {
  border-bottom: none;
}

.search-results a:hover {
  background: var(--bg-card);
}

.search-results .result-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.search-results .result-text {
  font-weight: 500;
  font-size: 0.95rem;
}

/* ---- Stats Bar ---- */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: var(--space-3xl);
  margin-top: var(--space-2xl);
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
  color: var(--text-on-gradient);
}

.stat-number {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  display: block;
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* ---- Section Headers ---- */
.section-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.section-header h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.section-header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* ---- Category Pills ---- */
.category-pills {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.category-pill {
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.category-pill:hover,
.category-pill.active {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* ---- Tool Cards Grid ---- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

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

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

.tool-card-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: var(--space-md);
  transition: transform var(--transition-fast);
}

.tool-card:hover .tool-card-icon {
  transform: scale(1.1);
}

.tool-card h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.tool-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.tool-card .card-arrow {
  position: absolute;
  bottom: var(--space-lg);
  left: var(--space-lg);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  font-size: 0.85rem;
  opacity: 0;
  transform: translateX(10px);
  transition: all var(--transition-normal);
}

.tool-card:hover .card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* Icon color classes */
.icon-blue { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.icon-purple { background: rgba(99, 102, 241, 0.12); color: #6366f1; }
.icon-green { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.icon-orange { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.icon-red { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.icon-pink { background: rgba(236, 72, 153, 0.12); color: #ec4899; }
.icon-teal { background: rgba(20, 184, 166, 0.12); color: #14b8a6; }
.icon-indigo { background: rgba(99, 102, 241, 0.12); color: #6366f1; }

[data-theme="dark"] .icon-blue { background: rgba(59, 130, 246, 0.2); }
[data-theme="dark"] .icon-purple { background: rgba(99, 102, 241, 0.2); }
[data-theme="dark"] .icon-green { background: rgba(16, 185, 129, 0.2); }
[data-theme="dark"] .icon-orange { background: rgba(245, 158, 11, 0.2); }
[data-theme="dark"] .icon-red { background: rgba(239, 68, 68, 0.2); }
[data-theme="dark"] .icon-pink { background: rgba(236, 72, 153, 0.2); }
[data-theme="dark"] .icon-teal { background: rgba(20, 184, 166, 0.2); }
[data-theme="dark"] .icon-indigo { background: rgba(99, 102, 241, 0.2); }

/* ---- Featured Tools (Larger Cards) ---- */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: var(--space-xl);
}

.featured-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.featured-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-gradient);
}

.featured-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.featured-card .tool-card-icon {
  width: 64px;
  height: 64px;
  font-size: 1.8rem;
}

.featured-card h3 {
  font-size: 1.3rem;
  margin-bottom: var(--space-sm);
}

.featured-card p {
  font-size: 1rem;
  margin-bottom: var(--space-lg);
}

.featured-card .btn-try {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: var(--accent-gradient);
  color: white;
  border-radius: var(--radius-xl);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.featured-card .btn-try:hover {
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  transform: translateX(-3px);
}

/* ---- Tool Page Layout ---- */
.tool-page {
  margin-top: var(--header-height);
  padding: var(--space-2xl) 0 var(--space-3xl);
}

.tool-page .container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--space-xl);
  align-items: start;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  font-size: 0.9rem;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.breadcrumbs a {
  color: var(--accent-primary);
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs .separator {
  margin: 0 var(--space-xs);
}

/* Tool Main Area */
.tool-main {
  min-width: 0;
}

.tool-header {
  margin-bottom: var(--space-xl);
}

.tool-header h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.tool-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.7;
}

/* Tool Box */
.tool-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  margin-bottom: var(--space-xl);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}

/* Form Elements */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-md);
}

.form-control {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-primary);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.form-control:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236366f1' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 2.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  font-family: var(--font-body);
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 25px rgba(99, 102, 241, 0.45);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

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

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

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.45);
  transform: translateY(-2px);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: var(--space-lg) var(--space-2xl);
  font-size: 1.1rem;
  border-radius: var(--radius-lg);
}

/* Result Box */
.result-box {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.08));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-top: var(--space-lg);
  display: none;
  animation: fadeInUp 0.4s ease;
}

.result-box.active {
  display: block;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-md);
}

.result-item {
  text-align: center;
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.result-value {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent-primary);
  display: block;
}

.result-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.result-text {
  font-size: 1.1rem;
  color: var(--text-primary);
  line-height: 1.8;
}

.result-highlight {
  font-weight: 700;
  color: var(--accent-primary);
}

/* ---- Sidebar ---- */
.sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--space-xl));
}

.sidebar-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  backdrop-filter: blur(10px);
}

.sidebar-box h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--border-color);
}

.sidebar-tool-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-sm);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-xs);
  transition: all var(--transition-fast);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.sidebar-tool-link:hover {
  background: var(--bg-primary);
  color: var(--accent-primary);
  padding-right: var(--space-md);
}

.sidebar-tool-link .link-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* ---- SEO Content Section ---- */
.seo-content {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  margin-top: var(--space-xl);
}

.seo-content h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  margin-top: var(--space-xl);
}

.seo-content h2:first-child {
  margin-top: 0;
}

.seo-content h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.seo-content p {
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.9;
}

.seo-content ul, .seo-content ol {
  padding-right: var(--space-xl);
  margin-bottom: var(--space-md);
}

.seo-content li {
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  line-height: 1.7;
  list-style: disc;
}

.seo-content ol li {
  list-style: decimal;
}

/* ---- Footer ---- */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
  padding: var(--space-3xl) 0 var(--space-xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
}

.footer-about h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.footer-about p {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 0.95rem;
}

.footer-links h4 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.footer-links a {
  display: block;
  color: var(--text-secondary);
  padding: var(--space-xs) 0;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.footer-links a:hover {
  color: var(--accent-primary);
  padding-right: var(--space-sm);
}

.footer-bottom {
  text-align: center;
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---- Scroll to top button ---- */
.scroll-top {
  position: fixed;
  bottom: 30px;
  left: 30px;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--accent-gradient);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all var(--transition-normal);
  z-index: 999;
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-3px);
}

/* ---- Loading Animation ---- */
.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Responsive Design ---- */
@media (max-width: 1024px) {
  .tool-page .container {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
  }

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

@media (max-width: 768px) {
  :root {
    --header-height: 60px;
  }

  .nav-links {
    display: none;
    position: fixed;
    top: var(--header-height);
    right: 0;
    left: 0;
    background: var(--bg-secondary);
    flex-direction: column;
    padding: var(--space-lg);
    gap: var(--space-sm);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
  }

  .nav-links.active {
    display: flex;
  }

  .nav-links a {
    width: 100%;
    padding: var(--space-md);
    border-radius: var(--radius-sm);
  }

  .nav-links a:hover {
    background: var(--bg-card);
  }

  .mobile-menu-btn {
    display: flex;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .stats-bar {
    gap: var(--space-lg);
  }

  .stat-number {
    font-size: 1.5rem;
  }

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

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

  .tool-box {
    padding: var(--space-lg);
  }

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

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

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

  .section-header h2 {
    font-size: 1.6rem;
  }

  .breadcrumbs {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .hero {
    min-height: 400px;
  }

  .hero h1 {
    font-size: 1.7rem;
  }

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

  .form-row {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 0 var(--space-md);
  }
}

/* ---- Print Styles ---- */
@media print {
  .header, .footer, .sidebar, .scroll-top, .theme-toggle {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .tool-page {
    margin-top: 0;
  }

  .tool-page .container {
    grid-template-columns: 1fr;
  }
}

/* ---- Animations ---- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger animation for tool cards */
.tool-card:nth-child(1) { transition-delay: 0.05s; }
.tool-card:nth-child(2) { transition-delay: 0.1s; }
.tool-card:nth-child(3) { transition-delay: 0.15s; }
.tool-card:nth-child(4) { transition-delay: 0.2s; }
.tool-card:nth-child(5) { transition-delay: 0.25s; }
.tool-card:nth-child(6) { transition-delay: 0.3s; }

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-top: var(--space-sm);
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-xl);
  transition: width 0.8s ease;
}

.progress-fill.green { background: linear-gradient(90deg, #10b981, #34d399); }
.progress-fill.yellow { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.progress-fill.orange { background: linear-gradient(90deg, #f97316, #fb923c); }
.progress-fill.red { background: linear-gradient(90deg, #ef4444, #f87171); }

/* BMI Categories */
.bmi-scale {
  display: flex;
  margin-top: var(--space-md);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 12px;
}

.bmi-scale span {
  flex: 1;
}

.bmi-indicator {
  position: relative;
  margin-top: var(--space-sm);
}

/* Privacy & About pages */
.page-content {
  margin-top: var(--header-height);
  padding: var(--space-3xl) 0;
}

.page-content .content-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  max-width: 800px;
  margin: 0 auto;
}

.page-content h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: var(--space-xl);
  text-align: center;
}

.page-content h2 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  color: var(--accent-primary);
}

.page-content p {
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.9;
}

/* Contact Form */
.contact-form {
  max-width: 600px;
  margin: 0 auto;
}

.contact-form .form-group {
  margin-bottom: var(--space-lg);
}

.contact-form textarea {
  min-height: 150px;
  resize: vertical;
}

/* Tooltip */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  right: 50%;
  transform: translateX(50%);
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ---- Calculator specific styles ---- */
.calc-display {
  background: var(--bg-primary);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: left;
  direction: ltr;
  margin-bottom: var(--space-md);
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.calc-expression {
  font-size: 1rem;
  color: var(--text-muted);
  min-height: 24px;
}

.calc-result {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.calc-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
}

.calc-btn {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-size: 1.3rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.calc-btn:hover {
  background: var(--bg-card-hover);
  transform: scale(1.05);
}

.calc-btn.operator {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-primary);
}

.calc-btn.operator:hover {
  background: rgba(99, 102, 241, 0.25);
}

.calc-btn.equals {
  background: var(--accent-gradient);
  color: white;
}

.calc-btn.equals:hover {
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.calc-btn.clear {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-red);
}

.calc-btn.clear:hover {
  background: rgba(239, 68, 68, 0.25);
}

.calc-btn.span-2 {
  grid-column: span 2;
}

/* QR Code Display */
.qr-display {
  text-align: center;
  padding: var(--space-xl);
}

.qr-display canvas,
.qr-display img {
  max-width: 250px;
  margin: var(--space-md) auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

/* Password Generator */
.password-output {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--bg-primary);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-md);
}

.password-output .password-text {
  flex: 1;
  font-family: 'Courier New', monospace;
  font-size: 1.2rem;
  direction: ltr;
  text-align: left;
  word-break: break-all;
  color: var(--text-primary);
}

.password-output .copy-btn {
  flex-shrink: 0;
  padding: var(--space-sm) var(--space-md);
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.password-output .copy-btn:hover {
  transform: scale(1.05);
}

/* Strength meter */
.strength-meter {
  display: flex;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
}

.strength-meter span {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border-light);
  transition: background var(--transition-fast);
}

/* Horoscope */
.horoscope-result {
  text-align: center;
}

.horoscope-symbol {
  font-size: 4rem;
  margin-bottom: var(--space-md);
}

.horoscope-name {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent-primary);
}

.horoscope-dates {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.horoscope-desc {
  margin-top: var(--space-md);
  color: var(--text-secondary);
  line-height: 1.8;
}

/* Speed Test */
.speed-gauge {
  text-align: center;
  padding: var(--space-xl);
}

.speed-value {
  font-family: var(--font-heading);
  font-size: 4rem;
  font-weight: 900;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.speed-unit {
  font-size: 1.2rem;
  color: var(--text-muted);
}

/* ---- Cookie/Notice bar ---- */
.notice-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  z-index: 1001;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform var(--transition-normal);
}

.notice-bar.visible {
  transform: translateY(0);
}

.notice-bar p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.notice-bar .btn {
  flex-shrink: 0;
}
