/* Tool Specific Styles */

/* Click Test Area */
.click-area {
  width: 100%;
  height: 300px;
  background: rgba(139, 92, 246, 0.05);
  border: 2px dashed rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.click-area:active {
  background: rgba(139, 92, 246, 0.1);
  transform: scale(0.99);
}

.click-area h2 {
  font-size: 2rem;
  margin-bottom: 10px;
  pointer-events: none;
}

.click-area p {
  color: var(--text-secondary);
  pointer-events: none;
}

/* Ripple Animation */
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: ripple 0.6s linear;
  background-color: rgba(255, 255, 255, 0.3);
  pointer-events: none;
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Stats Display */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 30px 0;
  width: 100%;
}

/* Colorful stat cards (applies everywhere) */
.stat-card {
  background: rgba(255, 255, 255, 0.03);
  padding: 20px;
  border-radius: var(--radius-md);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-width: 1.5px;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.stat-card:nth-child(1),
.stats-grid .stat-card:nth-child(1) {
  border-color: rgba(139, 92, 246, 0.5);
  background: rgba(139, 92, 246, 0.08);
}
.stat-card:nth-child(1) .stat-value {
  color: #a78bfa;
}

.stat-card:nth-child(2),
.stats-grid .stat-card:nth-child(2) {
  border-color: rgba(6, 182, 212, 0.5);
  background: rgba(6, 182, 212, 0.08);
}
.stat-card:nth-child(2) .stat-value {
  color: #22d3ee;
}

.stat-card:nth-child(3),
.stats-grid .stat-card:nth-child(3) {
  border-color: rgba(236, 72, 153, 0.5);
  background: rgba(236, 72, 153, 0.08);
}
.stat-card:nth-child(3) .stat-value {
  color: #f472b6;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.05);
}

/* Colorful live-stat boxes (global) */
.live-stat {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 18px 12px;
  text-align: center;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s;
}
.live-stat:nth-child(1) {
  border-color: rgba(139, 92, 246, 0.4);
  background: rgba(139, 92, 246, 0.06);
}
.live-stat:nth-child(1) .value {
  color: #a78bfa !important;
}
.live-stat:nth-child(2) {
  border-color: rgba(6, 182, 212, 0.4);
  background: rgba(6, 182, 212, 0.06);
}
.live-stat:nth-child(2) .value {
  color: #22d3ee !important;
}
.live-stat:nth-child(3) {
  border-color: rgba(236, 72, 153, 0.4);
  background: rgba(236, 72, 153, 0.06);
}
.live-stat:nth-child(3) .value {
  color: #f472b6 !important;
}

/* Colorful timer buttons (global) */
.timer-btn,
.timer-select .timer-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 22px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.95rem;
}
.timer-btn:hover,
.timer-select .timer-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  transform: translateY(-2px);
}

/* Per-duration timer button colors */
.timer-btn[data-time="1"].active {
  background: #06b6d4;
  border-color: #06b6d4;
  color: #fff;
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.45);
}
.timer-btn[data-time="3"].active {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.45);
}
.timer-btn[data-time="5"].active {
  background: #8b5cf6;
  border-color: #8b5cf6;
  color: #fff;
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.45);
}
.timer-btn[data-time="10"].active {
  background: #ec4899;
  border-color: #ec4899;
  color: #fff;
  box-shadow: 0 0 14px rgba(236, 72, 153, 0.45);
}
.timer-btn[data-time="15"].active {
  background: #f97316;
  border-color: #f97316;
  color: #fff;
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.45);
}
.timer-btn[data-time="30"].active {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.45);
}
.timer-btn[data-time="60"].active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.45);
}
.timer-btn[data-time="100"].active {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.45);
}
.timer-btn[data-time="120"].active {
  background: #14b8a6;
  border-color: #14b8a6;
  color: #fff;
  box-shadow: 0 0 14px rgba(20, 184, 166, 0.45);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  font-family: "Outfit", sans-serif;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 5px;
}

/* Timer Selection */
.timer-select {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  gap: 10px;
  margin-bottom: 30px;
  background: rgba(255, 255, 255, 0.05);
  padding: 5px;
  border-radius: var(--radius-md);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.timer-btn {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.timer-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transition: left 0.5s;
}

.timer-btn:hover::before {
  left: 100%;
}

.timer-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.timer-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

/* Result Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
  z-index: 10005; /* Above everything */
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s,
    visibility 0.3s;
  pointer-events: none; /* Prevent clicks when hidden */
}

.modal-overlay.show {
  display: flex !important; /* Force display when showing */
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important; /* Enable clicks when shown */
}

.tool-display-area {
  background: var(--bg-card);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-md);
  margin-top: 20px;
  width: 100%;
  max-width: 1400px; /* Increased from 800px to fit complex 3-column dashes */
}
.result-card {
  background: var(--bg-secondary);
  border: var(--glass-border);
  padding: 40px;
  border-radius: var(--radius-lg);
  text-align: center;
  max-width: 500px;
  width: 90%;
  transform: translateY(20px);
  transition: all 0.3s;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  max-height: 90vh;
  overflow: visible; /* Remove scrollbar by default */
  position: relative;
  z-index: 10006; /* Above modal overlay */
  pointer-events: auto; /* Ensure clicks work */
}

/* Only show scrollbar on very small screens */
@media (max-height: 600px) {
  .result-card {
    overflow-y: auto;
  }
}

/* Close Button */
.close-modal-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.8rem;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.close-modal-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg);
}

.result-card::-webkit-scrollbar {
  width: 4px; /* Thinner */
}

.result-card::-webkit-scrollbar-track {
  background: transparent;
}

.result-card::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1); /* More subtle */
  border-radius: 2px;
}

.result-card::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-overlay.show .result-card {
  transform: translateY(0);
}

.result-score {
  font-size: 4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 20px 0;
}

.rank-badge {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  font-weight: 600;
  color: var(--warning);
  margin-bottom: 20px;
}

/* Modal Actions (buttons container) */
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 30px;
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

.modal-actions .btn {
  position: relative;
  z-index: 10;
  pointer-events: auto !important;
  cursor: pointer !important;
  background: linear-gradient(135deg, #8b5cf6, #ec4899, #f59e0b);
  background-size: 200% 200%;
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
  transition: all 0.3s ease;
  animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.modal-actions .btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 8px 25px rgba(139, 92, 246, 0.5),
    0 0 30px rgba(236, 72, 153, 0.3);
}

.modal-actions .btn:active {
  transform: translateY(0) scale(0.98);
}

/* Attractive Restart Button */
.btn-restart {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
  padding: 10px 28px;
  border-radius: 50px;
  font-weight: 700;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-transform: uppercase;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  margin-top: 10px; /* Reduced gap default */
}

.btn-restart:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(139, 92, 246, 0.4);
}

.btn-restart i,
.btn-restart svg {
  width: 18px;
  height: 18px;
  transition: transform 0.5s ease;
}

.btn-restart:hover i,
.btn-restart:hover svg {
  transform: rotate(180deg);
}

/* NEW: Chart Container */
.chart-container {
  width: 100%;
  height: 300px; /* Increased from 200px to match tools */
  margin: 20px 0;
  background: #1e1e24; /* Match tool background */
  border-radius: 12px;
  position: relative;
  padding: 20px;
  overflow: hidden; /* Fix chart overflow globally */
  box-sizing: border-box;
}

.chart-canvas {
  width: 100%;
  height: 100%;
}

/* NEW: History Table */
.history-table {
  width: 100%;
  margin-top: 20px;
  border-collapse: collapse;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.history-table th,
.history-table td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.history-table th {
  font-weight: 600;
  color: var(--text-primary);
}

/* NEW: Settings Panel */
.tool-settings {
  margin-bottom: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.icon-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

/* Category color themes (Reusable on Body or Element) */
.theme-mouse {
  --primary: var(--neon-cyan);
  --primary-hover: #0891b2;
}

.theme-key {
  --primary: var(--neon-green);
  --primary-hover: #059669;
}

.theme-memory {
  --primary: var(--neon-blue);
  --primary-hover: #2563eb;
}

.theme-visual {
  --primary: var(--neon-orange);
  --primary-hover: #ea580c;
}

.theme-game {
  --primary: var(--neon-pink);
  --primary-hover: #db2777;
}

/* Add glow to stats in themes */
.theme-mouse .stat-value {
  text-shadow: 0 0 10px rgba(34, 211, 216, 0.3);
}
.theme-key .stat-value {
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}
.theme-memory .stat-value {
  text-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}
.theme-game .stat-value {
  text-shadow: 0 0 10px rgba(236, 72, 153, 0.3);
}

/* SEO Content Styles */
.seo-content {
  margin-top: 30px;
  margin-bottom: 40px;
  padding-top: 25px;
  border-top: 1px solid var(--border-color);
}

.content-block {
  margin-bottom: 18px;
}

.content-block h2 {
  font-size: 1.5rem;
  margin-bottom: 10px;
  color: #a78bfa;
  display: flex;
  align-items: center;
  gap: 12px;
}

.content-block h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
  color: #a78bfa;
}

.content-block p,
.content-block li {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.content-block ul,
.content-block ol {
  padding-left: 25px;
  margin-bottom: 12px;
}

.content-block li {
  margin-bottom: 10px;
}

/* SEO Content Tables */
.seo-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.seo-content th {
  background: rgba(139, 92, 246, 0.15);
  color: var(--text-primary);
  font-weight: 600;
  padding: 14px 18px;
  text-align: left;
  border-bottom: 2px solid rgba(139, 92, 246, 0.3);
  font-size: 0.95rem;
}

.seo-content td {
  padding: 12px 18px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.95rem;
}

.seo-content tr:hover td {
  background: rgba(139, 92, 246, 0.05);
}

.seo-content tr:last-child td {
  border-bottom: none;
}

@media (max-width: 600px) {
  .seo-content table {
    font-size: 0.85rem;
  }
  .seo-content th,
  .seo-content td {
    padding: 10px 12px;
  }
}

/* SEO Content Links */
.seo-content a {
  color: #a78bfa;
  text-decoration: underline;
  text-decoration-color: rgba(167, 139, 250, 0.4);
  text-underline-offset: 3px;
  transition: all 0.2s ease;
}

.seo-content a:hover {
  color: #c4b5fd;
  text-decoration-color: #c4b5fd;
  background: rgba(139, 92, 246, 0.1);
  border-radius: 3px;
  padding: 0 2px;
}

.faq-section details {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 15px;
  overflow: hidden;
  transition: all 0.3s;
}

.faq-section details:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
}

.faq-section summary {
  cursor: pointer;
  font-weight: 600;
  padding: 20px;
  list-style: none;
  position: relative;
  padding-right: 50px;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.faq-section summary::-webkit-details-marker {
  display: none;
}

.faq-section summary::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  color: var(--primary);
  font-weight: 300;
}

.faq-section details[open] summary::after {
  content: "-";
}

.faq-section details p {
  padding: 0 20px 20px;
  margin: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 15px;
  color: var(--text-secondary);
}

/* Tabs for FOV Calculator */
.calc-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.calc-tab {
  flex: 1;
  padding: 12px 20px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.calc-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.calc-tab.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3); /* using theme-game primary */
}

/* Range Sliders */
.range-group {
  display: flex;
  align-items: center;
  gap: 15px;
}

.range-group input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  outline: none;
}

.range-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  transition: transform 0.1s;
}

.range-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.range-val-input {
  width: 80px !important;
  text-align: center;
}

/* Triple Monitor Preview */
.triple-monitors {
  position: absolute;
  width: 100%;
  height: 100%;
  display: none; /* hidden by default */
  align-items: center;
  justify-content: center;
}

.triple-monitors.active {
  display: flex;
}

.monitor-center {
  width: 40%;
  height: 60%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.5);
}

.monitor-side {
  width: 35%;
  height: 55%;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  z-index: 1;
  background: rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
}

.monitor-left {
  transform: perspective(400px) rotateY(25deg) translateX(10%);
  transform-origin: right center;
}

.monitor-right {
    transform: perspective(400px) rotateY(-25deg) translateX(-10%);
    transform-origin: left center;
}

/* Qualitative Feedback Box */
.fov-feedback-box {
    background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid var(--primary);
    padding: 15px 20px;
    border-radius: 4px var(--radius-md) var(--radius-md) 4px;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.fov-feedback-box.optimal {
    border-left-color: #10b981; /* Green */
    background: rgba(16, 185, 129, 0.08);
}

.fov-feedback-box.warning {
    border-left-color: #f59e0b; /* Yellow */
    background: rgba(245, 158, 11, 0.08);
}

.fov-feedback-box.danger {
    border-left-color: #ef4444; /* Red */
    background: rgba(239, 68, 68, 0.08);
}

.fov-feedback-box h4 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.fov-feedback-box p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Tooltip for Advanced Metrics */
.tooltip-container {
    position: relative;
    cursor: help;
}

.tooltip-container span[title] {
    border-bottom: 1px dotted rgba(255, 255, 255, 0.5);
}

/* Categorized Game Output Grid */
.game-output-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 600px) {
    .game-output-grid {
        grid-template-columns: 1fr;
    }
}

.game-cat-title {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 5px;
}

.game-row {
    margin-bottom: 5px;
    font-size: 0.9rem;
}
