/* ==========================================================================
   RANKSAGES TOOLS - Premium Design System
   Based on UI/UX Pro Max recommendations:
   - Data-Dense Dashboard pattern
   - Dark Mode OLED style for tool interfaces
   - WCAG AAA contrast targets
   - Consistent component library across all 8 tools
   ========================================================================== */

/* --- TOOL PAGE LAYOUT --- */
.tool-page {
  --tool-card-bg: #ffffff;
  --tool-card-border: var(--border-light);
  --tool-card-radius: 20px;
  --tool-card-shadow: 0 4px 20px rgba(10,22,40,.06);
  --tool-card-shadow-hover: 0 12px 40px rgba(10,22,40,.1);
  --tool-input-height: 48px;
  --tool-input-radius: 10px;
  --tool-input-border: var(--border);
  --tool-input-focus: var(--accent);
  --tool-spacing: 24px;
}

/* --- TOOL CARDS (Input forms, output sections) --- */
.tool-card {
  background: var(--tool-card-bg);
  border: 1px solid var(--tool-card-border);
  border-radius: var(--tool-card-radius);
  padding: 36px;
  transition: box-shadow .3s ease, border-color .3s ease;
  position: relative;
  overflow: hidden;
}
.tool-card:hover {
  box-shadow: var(--tool-card-shadow-hover);
}
/* Top accent stripe on cards */
.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--secondary));
  opacity: 0;
  transition: opacity .3s;
}
.tool-card:hover::before {
  opacity: 1;
}
/* Card with specific accent color */
.tool-card[data-accent]::before {
  opacity: 1;
}

.tool-card-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tool-card-title i {
  font-size: 20px;
}

/* --- TOOL INPUTS --- */
.tool-label {
  display: block;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 6px;
  letter-spacing: .01em;
}
.tool-label .required {
  color: var(--accent);
  margin-left: 2px;
}
.tool-label .optional {
  color: var(--muted);
  font-weight: 400;
}

.tool-input,
.tool-select,
.tool-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--tool-input-border);
  border-radius: var(--tool-input-radius);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--body-text);
  background: var(--tool-card-bg);
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
  -webkit-appearance: none;
}
.tool-input:focus,
.tool-select:focus,
.tool-textarea:focus {
  outline: none;
  border-color: var(--tool-input-focus);
  box-shadow: 0 0 0 4px rgba(242,101,34,.08);
}
.tool-input::placeholder,
.tool-textarea::placeholder {
  color: var(--light-text);
}
.tool-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}
.tool-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%235A6270' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.tool-input-help {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* Input grid layouts */
.tool-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--tool-spacing);
}
.tool-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--tool-spacing);
}
.tool-field {
  margin-bottom: 20px;
}

/* --- TOOL BUTTONS --- */
.tool-btn-primary {
  width: 100%;
  padding: 16px 32px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--tool-input-radius);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.tool-btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.15), transparent);
  transform: translateX(-100%);
  transition: transform .5s;
}
.tool-btn-primary:hover::before {
  transform: translateX(100%);
}
.tool-btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(242,101,34,.3);
}
.tool-btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.tool-btn-primary:disabled::before {
  display: none;
}

/* AI Enhance button */
.tool-btn-ai {
  padding: 12px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .2s;
  white-space: nowrap;
}
.tool-btn-ai:hover {
  background: #162847;
  transform: translateY(-1px);
}
.tool-btn-ai.success {
  background: #22C55E;
}

/* Copy button */
.tool-btn-copy {
  padding: 8px 16px;
  background: var(--secondary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .2s;
}
.tool-btn-copy:hover {
  background: var(--secondary-light);
}

/* Secondary/outline button */
.tool-btn-secondary {
  padding: 8px 16px;
  background: var(--bg);
  color: var(--secondary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all .2s;
}
.tool-btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- AI ENHANCE BANNER --- */
.tool-ai-banner {
  background: linear-gradient(90deg, var(--primary), #162847);
  border-radius: var(--tool-card-radius);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.tool-ai-banner-text {
  flex: 1;
  min-width: 200px;
}
.tool-ai-banner-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}
.tool-ai-banner-desc {
  font-size: 13px;
  color: rgba(255,255,255,.5);
  margin-top: 2px;
}

/* --- TOOL OUTPUT (Code blocks, results) --- */
.tool-code-block {
  background: var(--primary);
  color: #e2e8f0;
  padding: 20px;
  border-radius: var(--radius);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  overflow-x: auto;
  line-height: 1.7;
  margin: 0;
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,.06);
}

/* --- TOOL SCORE DISPLAY --- */
.tool-score-circle {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: 800;
}
.tool-score-circle-lg {
  width: 100px;
  height: 100px;
  font-size: 32px;
}
.tool-score-circle-md {
  width: 72px;
  height: 72px;
  font-size: 26px;
}
.tool-score-good {
  border: 5px solid #22C55E;
  color: #22C55E;
}
.tool-score-ok {
  border: 5px solid #FF9800;
  color: #FF9800;
}
.tool-score-bad {
  border: 5px solid #E53935;
  color: #E53935;
}

/* --- TOOL VALIDATION STATUS --- */
.tool-validation {
  border-radius: var(--tool-card-radius);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.tool-validation-pass {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
}
.tool-validation-fail {
  background: #FEF2F2;
  border: 1px solid #FECACA;
}

/* --- TOOL CHECK ITEMS (Pass/Fail list) --- */
.tool-check-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--bg);
  align-items: flex-start;
}
.tool-check-item:last-child {
  border-bottom: none;
}
.tool-check-icon {
  flex-shrink: 0;
  margin-top: 3px;
  font-size: 14px;
}
.tool-check-icon.pass { color: #22C55E; }
.tool-check-icon.fail { color: #E53935; }
.tool-check-icon.warn { color: #FF9800; }
.tool-check-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}
.tool-check-message {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.5;
}
.tool-check-value {
  font-size: 13px;
  color: var(--muted);
}

/* --- TOOL PROGRESS --- */
.tool-loading {
  text-align: center;
  padding: 60px 0;
}
.tool-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--bg);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: toolSpin 1s linear infinite;
  margin: 0 auto 16px;
}
@keyframes toolSpin { to { transform: rotate(360deg); } }
.tool-loading-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
}
.tool-loading-status {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.tool-progress-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 16px;
}
.tool-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .5s;
}

/* --- TOOL METRIC CARDS --- */
.tool-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.tool-metric {
  background: var(--tool-card-bg);
  border: 1px solid var(--tool-card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  transition: all .2s;
}
.tool-metric:hover {
  box-shadow: var(--tool-card-shadow);
  transform: translateY(-2px);
}
.tool-metric-icon {
  font-size: 20px;
  margin-bottom: 8px;
  display: block;
}
.tool-metric-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}
.tool-metric-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

/* --- TOOL CTA SECTION --- */
.tool-cta {
  background: linear-gradient(135deg, var(--primary), #162847);
  border-radius: var(--tool-card-radius);
  padding: 40px;
  text-align: center;
}
.tool-cta h3 {
  color: #fff;
  margin-bottom: 8px;
}
.tool-cta p {
  color: rgba(255,255,255,.6);
  font-size: 15px;
  margin-bottom: 20px;
}

/* --- TOOL TIPS/RECOMMENDATIONS --- */
.tool-tip {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--bg);
  align-items: flex-start;
}
.tool-tip:last-child {
  border-bottom: none;
}
.tool-tip-icon {
  color: var(--accent);
  margin-top: 3px;
  flex-shrink: 0;
}
.tool-tip-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}
.tool-tip-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* --- TOOL KEYWORD CHIPS --- */
.tool-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tool-chip {
  padding: 6px 14px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-size: 13px;
  color: var(--body-text);
  transition: all .2s;
}
.tool-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.tool-chip-red {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #E53935;
}

/* --- TOOL TABLE --- */
.tool-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tool-table th {
  padding: 12px;
  text-align: left;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 2px solid var(--border-light);
}
.tool-table td {
  padding: 12px;
  border-bottom: 1px solid var(--bg);
  color: var(--muted);
}
.tool-table tr:hover td {
  background: rgba(242,101,34,.02);
}

/* --- TOOL COMPARISON ROW --- */
.tool-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--bg);
  font-size: 14px;
}
.tool-comparison-label {
  font-weight: 600;
  color: var(--primary);
}
.tool-comparison-good {
  color: #22C55E;
  font-weight: 500;
}
.tool-comparison-bad {
  color: var(--muted);
}

/* --- TOOL CATEGORY BAR --- */
.tool-category-bar {
  margin-bottom: 12px;
}
.tool-category-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}
.tool-category-bar-label {
  font-weight: 600;
  color: var(--primary);
}
.tool-category-bar-score {
  color: var(--muted);
}
.tool-category-bar-track {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}
.tool-category-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .5s;
}

/* --- VIRTUAL EMPLOYEE CARDS --- */
.ve-card {
  background: var(--tool-card-bg);
  border: 1px solid var(--tool-card-border);
  border-radius: var(--tool-card-radius);
  padding: 28px;
  cursor: pointer;
  transition: all .3s;
}
.ve-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--tool-card-shadow-hover);
}
.ve-avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  margin-bottom: 16px;
}
.ve-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}
.ve-role {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
.ve-online {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #22C55E;
  margin-bottom: 12px;
}
.ve-online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22C55E;
}
.ve-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 16px;
}
.ve-chat-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

/* --- CHAT INTERFACE --- */
.ve-chat-header {
  background: linear-gradient(135deg, var(--primary), #162847);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.ve-chat-messages {
  height: 400px;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg);
}
.ve-chat-input-wrap {
  padding: 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 10px;
}
.ve-msg-bot {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: flex-start;
}
.ve-msg-user {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}
.ve-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  flex-shrink: 0;
}
.ve-msg-bubble-bot {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 0 12px 12px 12px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--body-text);
  line-height: 1.7;
  max-width: 80%;
  white-space: pre-wrap;
}
.ve-msg-bubble-user {
  color: #fff;
  border-radius: 12px 0 12px 12px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
  max-width: 80%;
}
.ve-starters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding: 0 12px;
}
.ve-starter-btn {
  padding: 8px 16px;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-size: 13px;
  color: var(--secondary);
  cursor: pointer;
  transition: all .2s;
}
.ve-starter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  .tool-card { padding: 24px 20px; }
  .tool-grid-2, .tool-grid-3 { grid-template-columns: 1fr; }
  .tool-metrics { grid-template-columns: 1fr 1fr; }
  .tool-comparison { grid-template-columns: 1fr; gap: 4px; }
  .tool-ai-banner { flex-direction: column; }
  .tool-btn-primary { font-size: 15px; padding: 14px 24px; }
  .ve-chat-messages { height: 300px; }
  .tool-score-circle-lg { width: 80px; height: 80px; font-size: 28px; }
}
@media (max-width: 480px) {
  .tool-card { padding: 20px 16px; }
  .tool-metrics { grid-template-columns: 1fr; }
  .tool-metric-value { font-size: 24px; }
}
