/* ==========================================================================
   Popupsnap FreeTools — tools.css
   Dark theme, RTL-first, mobile-first responsive stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
  --ft-bg: #0B0F1A;
  --ft-card-bg: rgba(255, 255, 255, 0.05);
  --ft-card-border: rgba(255, 255, 255, 0.1);
  --ft-primary: #6366F1;
  --ft-primary-hover: #8B5CF6;
  --ft-primary-glow: rgba(99, 102, 241, 0.4);
  --ft-success: #10B981;
  --ft-warning: #F59E0B;
  --ft-error: #EF4444;
  --ft-text: #FFFFFF;
  --ft-text-secondary: rgba(255, 255, 255, 0.7);
  --ft-text-muted: rgba(255, 255, 255, 0.4);
  --ft-radius-card: 16px;
  --ft-radius-input: 12px;
  --ft-radius-btn: 999px;
  --ft-font-ar: 'Cairo', -apple-system, BlinkMacSystemFont, sans-serif;
  --ft-font-en: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* --------------------------------------------------------------------------
   2. Container & Layout
   -------------------------------------------------------------------------- */
.container-tools {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

@media (min-width: 768px) {
  .container-tools { padding: 0 24px; }
}

/* --------------------------------------------------------------------------
   3. Hero Section
   -------------------------------------------------------------------------- */
.tools-hero {
  padding: 120px 0 60px;
  text-align: center;
}

.tools-hero h1 {
  font-family: var(--ft-font-ar);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.4;
  margin: 0 0 16px;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.8) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--ft-text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.8;
}

@media (min-width: 768px) {
  .tools-hero { padding: 160px 0 80px; }
  .tools-hero h1 { font-size: 40px; }
  .hero-subtitle { font-size: 18px; }
}

/* --------------------------------------------------------------------------
   4. Breadcrumbs
   -------------------------------------------------------------------------- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ft-text-muted);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.breadcrumbs a {
  color: var(--ft-text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumbs a:hover { color: var(--ft-primary); }
.breadcrumb-sep { color: var(--ft-text-muted); }
.breadcrumb-current { color: var(--ft-text); }

/* --------------------------------------------------------------------------
   5. Tools Grid (Hub Page)
   -------------------------------------------------------------------------- */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 40px;
}

@media (min-width: 768px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}

@media (min-width: 1024px) {
  .tools-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; }
}

/* --------------------------------------------------------------------------
   6. Tool Card
   -------------------------------------------------------------------------- */
.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 24px;
  background: var(--ft-card-bg);
  border: 1px solid var(--ft-card-border);
  border-radius: var(--ft-radius-card);
  text-decoration: none;
  color: var(--ft-text);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}

.tool-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Active card (has a real link) */
.tool-card--active {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.15);
}

/* Coming soon card */
.tool-card.coming-soon {
  opacity: 0.5;
  pointer-events: none;
}

.tool-card.coming-soon:hover {
  transform: none;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   7. Tool Card Icon
   -------------------------------------------------------------------------- */
.tool-card__icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--ft-primary) 0%, var(--ft-primary-hover) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 24px;
  color: #fff;
}

/* --------------------------------------------------------------------------
   8. Tool Card Title, Description, Button
   -------------------------------------------------------------------------- */
.tool-card__title {
  font-family: var(--ft-font-ar);
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
}

.tool-card__desc {
  font-size: 14px;
  color: var(--ft-text-secondary);
  line-height: 1.6;
  margin: 0 0 20px;
}

.tool-card__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--ft-radius-btn);
  background: rgba(99, 102, 241, 0.15);
  color: var(--ft-primary);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
}

.tool-card:hover .tool-card__btn {
  background: var(--ft-primary);
  color: #fff;
}

/* --------------------------------------------------------------------------
   9. Coming Soon Badge
   -------------------------------------------------------------------------- */
.coming-soon-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 4px 12px;
  border-radius: var(--ft-radius-btn);
  background: rgba(255, 255, 255, 0.1);
  color: var(--ft-text-muted);
  font-size: 12px;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   10. Calculator Container & Inputs
   -------------------------------------------------------------------------- */
.calc-container {
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.calc-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: right;
}

.calc-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ft-text-secondary);
}

.calc-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--ft-card-border);
  border-radius: var(--ft-radius-input);
  background: var(--ft-card-bg);
  color: var(--ft-text);
  font-family: var(--ft-font-ar);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  direction: rtl;
}

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

.calc-input:focus {
  border-color: var(--ft-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.calc-input.error {
  border-color: var(--ft-error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.calc-input-error {
  font-size: 13px;
  color: var(--ft-error);
  min-height: 18px;
}

/* --------------------------------------------------------------------------
   11. Calculate Button
   -------------------------------------------------------------------------- */
.calc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  padding: 0 32px;
  border: none;
  border-radius: var(--ft-radius-btn);
  background: linear-gradient(135deg, var(--ft-primary) 0%, var(--ft-primary-hover) 100%);
  color: #fff;
  font-family: var(--ft-font-ar);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 10px 30px var(--ft-primary-glow);
  text-decoration: none;
}

.calc-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px var(--ft-primary-glow);
}

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

.calc-btn--secondary {
  background: transparent;
  border: 2px solid var(--ft-primary);
  color: var(--ft-primary);
  box-shadow: none;
}

.calc-btn--secondary:hover {
  background: rgba(99, 102, 241, 0.1);
  box-shadow: none;
}

@media (min-width: 768px) {
  .calc-btn { width: auto; min-width: 200px; }
}

/* --------------------------------------------------------------------------
   12. Results Section
   -------------------------------------------------------------------------- */
.calc-section {
  padding: 60px 0;
}

.calc-results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 40px;
}

@media (min-width: 768px) {
  .calc-results-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}

@media (min-width: 1024px) {
  .calc-results-grid { grid-template-columns: repeat(3, 1fr); }
}

/* --------------------------------------------------------------------------
   13. Result Cards
   -------------------------------------------------------------------------- */
.calc-result-card {
  padding: 24px;
  background: var(--ft-card-bg);
  border: 1px solid var(--ft-card-border);
  border-radius: var(--ft-radius-card);
  text-align: center;
}

.calc-result-card--primary {
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.08);
}

.calc-result-card--highlight {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.08);
  grid-column: 1 / -1;
}

.calc-result-label {
  display: block;
  font-size: 13px;
  color: var(--ft-text-secondary);
  margin-bottom: 8px;
}

.calc-result-number {
  display: block;
  font-family: var(--ft-font-en);
  font-size: 32px;
  font-weight: 800;
  color: var(--ft-text);
  margin-bottom: 4px;
}

.calc-result-hint {
  font-size: 13px;
  color: var(--ft-text-secondary);
  margin: 8px 0 0;
}

/* --------------------------------------------------------------------------
   14. Performance Badge
   -------------------------------------------------------------------------- */
.calc-performance-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--ft-radius-btn);
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
}

.performance--weak { background: rgba(239, 68, 68, 0.15); color: #EF4444; }
.performance--below { background: rgba(245, 158, 11, 0.15); color: #F59E0B; }
.performance--average { background: rgba(234, 179, 8, 0.15); color: #EAB308; }
.performance--good { background: rgba(16, 185, 129, 0.15); color: #10B981; }
.performance--excellent { background: rgba(34, 197, 94, 0.15); color: #22C55E; }

/* --------------------------------------------------------------------------
   15. Comparison Bar
   -------------------------------------------------------------------------- */
.calc-comparison-bar-container {
  margin: 40px 0;
  padding: 24px;
  background: var(--ft-card-bg);
  border: 1px solid var(--ft-card-border);
  border-radius: var(--ft-radius-card);
}

.calc-comparison-bar-container h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 20px;
  text-align: center;
}

.calc-comparison-bar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.calc-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  border-radius: 8px;
  padding: 0 16px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 80px;
}

.calc-bar--current {
  background: linear-gradient(90deg, var(--ft-primary), var(--ft-primary-hover));
}

.calc-bar--benchmark {
  background: linear-gradient(90deg, var(--ft-success), #34D399);
}

.calc-bar-label {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.calc-bar-value {
  font-size: 14px;
  font-weight: 800;
  margin-inline-start: auto;
}

/* --------------------------------------------------------------------------
   16. Content Sections (What is, How to, etc.)
   -------------------------------------------------------------------------- */
.content-section {
  padding: 60px 0;
  border-top: 1px solid var(--ft-card-border);
}

.content-section h2 {
  font-family: var(--ft-font-ar);
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 24px;
  text-align: center;
}

.content-section p {
  font-size: 16px;
  line-height: 1.9;
  color: var(--ft-text-secondary);
  max-width: 800px;
  margin: 0 auto 16px;
}

@media (min-width: 768px) {
  .content-section h2 { font-size: 28px; }
}

/* --------------------------------------------------------------------------
   17. Steps Grid
   -------------------------------------------------------------------------- */
.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 32px;
}

@media (min-width: 768px) {
  .steps-grid { grid-template-columns: repeat(3, 1fr); }
}

.step-card {
  padding: 28px 24px;
  background: var(--ft-card-bg);
  border: 1px solid var(--ft-card-border);
  border-radius: var(--ft-radius-card);
  text-align: center;
}

.step-number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ft-primary), var(--ft-primary-hover));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 16px;
}

.step-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 8px;
}

.step-card p {
  font-size: 14px;
  color: var(--ft-text-secondary);
  line-height: 1.7;
  margin: 0;
}

/* --------------------------------------------------------------------------
   18. Comparison Table
   -------------------------------------------------------------------------- */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 24px;
  overflow-x: auto;
  display: block;
}

@media (min-width: 768px) {
  .comparison-table { display: table; }
}

.comparison-table th,
.comparison-table td {
  padding: 14px 16px;
  text-align: center;
  border-bottom: 1px solid var(--ft-card-border);
  font-size: 14px;
  white-space: nowrap;
}

.comparison-table th {
  background: var(--ft-card-bg);
  font-weight: 700;
  color: var(--ft-text);
}

.comparison-table td:first-child {
  text-align: right;
  font-weight: 600;
}

.comparison-table .check { color: var(--ft-success); }
.comparison-table .cross { color: var(--ft-text-muted); }

/* --------------------------------------------------------------------------
   19. Use Cases Grid
   -------------------------------------------------------------------------- */
.use-case-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 24px;
}

@media (min-width: 768px) {
  .use-case-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}

.use-case-card {
  padding: 24px;
  background: var(--ft-card-bg);
  border: 1px solid var(--ft-card-border);
  border-radius: var(--ft-radius-card);
}

.use-case-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.use-case-card h3 i {
  color: var(--ft-primary);
  font-size: 18px;
}

.use-case-card p {
  font-size: 14px;
  color: var(--ft-text-secondary);
  line-height: 1.7;
  margin: 0;
}

/* --------------------------------------------------------------------------
   20. FAQ Accordion
   -------------------------------------------------------------------------- */
.faq-accordion {
  max-width: 800px;
  margin: 24px auto 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-item {
  background: var(--ft-card-bg);
  border: 1px solid var(--ft-card-border);
  border-radius: var(--ft-radius-card);
  overflow: hidden;
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 18px 20px;
  background: none;
  border: none;
  color: var(--ft-text);
  font-family: var(--ft-font-ar);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: right;
  transition: color 0.2s;
}

.faq-question:hover { color: var(--ft-primary); }

.faq-question i {
  transition: transform 0.3s ease;
  font-size: 12px;
  flex-shrink: 0;
  margin-inline-start: 12px;
}

.faq-item.active .faq-question i {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-item.active .faq-answer {
  max-height: 300px;
  padding: 0 20px 18px;
}

.faq-answer p {
  font-size: 14px;
  color: var(--ft-text-secondary);
  line-height: 1.8;
  margin: 0;
}

/* --------------------------------------------------------------------------
   21. Related Tools Grid
   -------------------------------------------------------------------------- */
.related-tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 24px;
}

@media (min-width: 768px) {
  .related-tools-grid { grid-template-columns: repeat(3, 1fr); }
}

/* --------------------------------------------------------------------------
   22. Blog Cards
   -------------------------------------------------------------------------- */
.blog-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 24px;
}

@media (min-width: 768px) {
  .blog-cards { grid-template-columns: repeat(3, 1fr); }
}

.blog-card {
  padding: 24px;
  background: var(--ft-card-bg);
  border: 1px solid var(--ft-card-border);
  border-radius: var(--ft-radius-card);
  text-decoration: none;
  color: var(--ft-text);
  transition: transform 0.2s, border-color 0.2s;
}

.blog-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.3);
}

.blog-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.5;
}

.blog-card p {
  font-size: 13px;
  color: var(--ft-text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* --------------------------------------------------------------------------
   23. Footer CTA
   -------------------------------------------------------------------------- */
.footer-cta {
  padding: 60px 20px;
  margin: 40px 0;
  background: linear-gradient(135deg, var(--ft-primary) 0%, var(--ft-primary-hover) 100%);
  border-radius: var(--ft-radius-card);
  text-align: center;
}

.footer-cta h2 {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 12px;
  color: #fff;
}

.footer-cta p {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 28px;
}

.footer-cta-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

@media (min-width: 768px) {
  .footer-cta h2 { font-size: 32px; }
  .footer-cta-buttons { flex-direction: row; justify-content: center; }
}

.footer-cta .calc-btn {
  background: #fff;
  color: var(--ft-primary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.footer-cta .calc-btn--secondary {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}

/* --------------------------------------------------------------------------
   24. Bridge CTA
   -------------------------------------------------------------------------- */
.bridge-cta {
  margin-top: 40px;
  padding: 32px 24px;
  background: var(--ft-card-bg);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--ft-radius-card);
  text-align: center;
}

.bridge-cta h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 12px;
}

.bridge-cta p {
  font-size: 15px;
  color: var(--ft-text-secondary);
  line-height: 1.7;
  margin: 0 0 24px;
  max-width: none;
}

.bridge-cta-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

@media (min-width: 768px) {
  .bridge-cta-buttons { flex-direction: row; justify-content: center; }
}

/* --------------------------------------------------------------------------
   25. Sticky Mobile CTA
   -------------------------------------------------------------------------- */
.sticky-mobile-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 20px;
  background: rgba(11, 15, 26, 0.95);
  border-top: 1px solid var(--ft-card-border);
  backdrop-filter: blur(12px);
  z-index: 999;
  text-align: center;
}

.sticky-mobile-cta .calc-btn {
  width: 100%;
  height: 48px;
  font-size: 15px;
}

@media (min-width: 768px) {
  .sticky-mobile-cta { display: none !important; }
}

/* --------------------------------------------------------------------------
   26. Numeral Toggle
   -------------------------------------------------------------------------- */
.numeral-toggle {
  text-align: center;
  margin-top: 16px;
}

.numeral-toggle-btn {
  padding: 8px 20px;
  border: 1px solid var(--ft-card-border);
  border-radius: var(--ft-radius-btn);
  background: transparent;
  color: var(--ft-text-secondary);
  font-family: var(--ft-font-ar);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.numeral-toggle-btn:hover {
  border-color: var(--ft-primary);
  color: var(--ft-primary);
}

/* --------------------------------------------------------------------------
   27. Footer
   -------------------------------------------------------------------------- */
.footer-tools {
  padding: 60px 0 40px;
  border-top: 1px solid var(--ft-card-border);
  margin-top: 40px;
}

/* --------------------------------------------------------------------------
   28. Animations & Utilities
   -------------------------------------------------------------------------- */

/* Smooth reveal for results */
.calc-results-enter {
  animation: fadeSlideUp 0.5s ease forwards;
}

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

/* RTL helpers */
[dir="rtl"] .breadcrumbs { direction: rtl; }
[dir="rtl"] .calc-input { text-align: right; }

/* Focus visible for accessibility */
*:focus-visible {
  outline: 2px solid var(--ft-primary);
  outline-offset: 2px;
}

/* Selection color */
::selection {
  background: rgba(99, 102, 241, 0.3);
  color: #fff;
}
