/* ========================================
   tools.css - Unified Tool Pages Stylesheet
   Colors match frontend: Primary #54B689
   Font: Roboto
   ======================================== */

/* Bootstrap Variable Overrides */
:root {
  --tool-primary: #54B689;
  --tool-primary-dark: #3d8b67;
  --tool-primary-rgb: 84, 182, 137;
  --tool-accent: #0dcaf0;
  --tool-success: #28a745;
  --tool-danger: #dc3545;
  --tool-warning: #ffc107;
  --tool-info: #17a2b8;
  --tool-dark: #292929;
  --tool-muted: #6b7280;
  --tool-card-bg: #ffffff;
  --tool-border: #e5e7eb;
  --tool-body-bg: #f3f6f9;
}

/* ============ BASE ============ */
.tool-page {
  font-family: 'Roboto', sans-serif;
  color: #4f4f4f;
}
.tool-page h1, .tool-page h2, .tool-page h3, .tool-page h4, .tool-page h5, .tool-page h6 {
  color: var(--tool-dark);
  font-weight: 700;
}
.tool-page a { color: var(--tool-primary); }
.tool-page a:hover { color: var(--tool-primary-dark); }

/* ============ HERO ============ */
.tool-hero {
  background: linear-gradient(135deg, #1a3a2a 0%, #2d5a3e 50%, #1a3a2a 100%);
  padding: 2rem 0;
}
.tool-hero h1 { font-size: 1.6rem; font-weight: 700; color: #fff; }
.tool-hero .lead { font-size: 0.95rem; opacity: 0.8; max-width: 540px; color: #fff; }
.tool-hero .back-link { color: rgba(255,255,255,0.6); }
.tool-hero .back-link:hover { color: #fff; }

/* ============ WRAPPER ============ */
.tool-wrapper { padding: 1.5rem 0 2.5rem; }

/* ============ CARDS ============ */
.tool-card {
  background: var(--tool-card-bg);
  border: 1px solid var(--tool-border);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
  overflow: hidden;
}
.tool-card-header {
  background: linear-gradient(135deg, var(--tool-primary), var(--tool-primary-dark));
  color: #fff;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 14px 14px 0 0;
}
.tool-card-header h4 { margin: 0; font-size: 1.05rem; font-weight: 600; color: #fff; }
.tool-card-header .subtitle { font-size: 0.8rem; opacity: 0.85; }
.tool-card-body { padding: 1.5rem; }

.card-section {
  background: #fff;
  border: 1px solid var(--tool-border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.card-section:last-child { margin-bottom: 0; }
.card-section h5 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.75rem; }

.tool-result-card {
  background: #fff;
  border: 1px solid var(--tool-border);
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  height: 100%;
}
.tool-result-card h5 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.75rem; }

/* ============ FORM ELEMENTS ============ */
.tool-page .form-control,
.tool-page .form-select {
  border-radius: 10px;
  border: 2px solid var(--tool-border);
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  transition: border-color 0.2s;
}
.tool-page .form-control:focus,
.tool-page .form-select:focus {
  border-color: var(--tool-primary);
  box-shadow: 0 0 0 3px rgba(84, 182, 137, 0.15);
}
.tool-page .form-label { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.35rem; }

/* ============ BUTTONS ============ */
.btn-tool-primary {
  background: var(--tool-primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.55rem 1.2rem;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.btn-tool-primary:hover {
  background: var(--tool-primary-dark);
  color: #fff;
  transform: translateY(-1px);
}

.btn-tool-outline {
  background: transparent;
  border: 2px solid var(--tool-border);
  border-radius: 10px;
  padding: 0.5rem 1rem;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--tool-dark);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.btn-tool-outline:hover {
  background: #f1f5f9;
  border-color: var(--tool-primary);
  color: var(--tool-primary);
}

.btn-tool-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }

/* ============ STATS ============ */
.tool-stat {
  text-align: center;
  padding: 0.85rem;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px solid var(--tool-border);
}
.tool-stat .label { font-size: 0.78rem; color: var(--tool-muted); margin-bottom: 0.2rem; }
.tool-stat .value { font-size: 1.3rem; font-weight: 700; }

/* ============ TABLES ============ */
.tool-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.tool-table th, .tool-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
}
.tool-table th { color: var(--tool-muted); font-weight: 500; }
.tool-table-responsive { max-height: 360px; overflow: auto; }

/* ============ UTILITY ============ */
.tool-note {
  border: 1px dashed #fde68a;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  background: #fffef6;
  color: #92400e;
  font-size: 0.85rem;
}
.small-muted { color: var(--tool-muted); font-size: 0.85rem; }
.no-print { display: block; }
.currency-symbol {
  display: flex;
  align-items: center;
  padding: 0.55rem 0.9rem;
  border: 2px solid var(--tool-border);
  border-radius: 10px;
  background: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--tool-dark);
}
.pre-block {
  background: #f8fafc;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  border: 1px solid var(--tool-border);
  overflow-x: auto;
}

/* ============ TOOL HELP SECTION ============ */
.tool-help-section {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 1.25rem;
  margin-top: 1rem;
}
.tool-help-section h5 { color: #166534; margin-bottom: 0.75rem; }
.tool-help-section ol, .tool-help-section ul { font-size: 0.88rem; color: #374151; padding-left: 1.25rem; }
.tool-help-section ol li, .tool-help-section ul li { margin-bottom: 0.35rem; }
.tool-help-section .tool-note { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }

/* ============ TABS ============ */
.tool-tabs {
  border-bottom: 2px solid var(--tool-border);
  margin-bottom: 1rem;
}
.tool-tabs .nav-link {
  border: 2px solid var(--tool-border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 0.6rem 1.2rem;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--tool-muted);
  background: transparent;
  margin-right: 4px;
  transition: all 0.2s;
}
.tool-tabs .nav-link:hover {
  color: var(--tool-primary);
  background: rgba(84, 182, 137, 0.05);
}
.tool-tabs .nav-link.active {
  color: var(--tool-primary);
  background: #fff;
  border-color: var(--tool-primary);
  border-bottom: 2px solid #fff;
  margin-bottom: -2px;
}

/* ============ TAGS / BADGES ============ */
.tool-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}
.tool-badge-green { background: #dcfce7; color: #166534; }
.tool-badge-blue { background: #dbeafe; color: #1e40af; }
.tool-badge-red { background: #fce4ec; color: #b91c1c; }
.tool-badge-yellow { background: #fef3c7; color: #92400e; }

/* ============ PASSWORD GENERATOR ============ */
.password-strength-bar {
  height: 8px;
  border-radius: 4px;
  transition: all 0.3s;
  margin-top: 0.5rem;
}
.password-input-wrap { position: relative; }
.password-input-wrap .form-control { padding-right: 3rem; }
.password-toggle-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--tool-muted);
  cursor: pointer;
  padding: 0.35rem;
}
.password-toggle-btn:hover { color: var(--tool-dark); }
.password-copy-btn {
  position: absolute;
  right: 2.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--tool-muted);
  cursor: pointer;
  padding: 0.35rem;
}
.password-copy-btn:hover { color: var(--tool-primary); }

/* ============ TYPING SPEED TEST ============ */
.typing-text-display {
  font-size: 1.2rem;
  line-height: 1.8;
  padding: 1.25rem;
  background: #f8fafc;
  border: 2px solid var(--tool-border);
  border-radius: 10px;
  min-height: 120px;
  user-select: none;
  font-family: 'Roboto Mono', monospace;
}
.typing-text-display .char { transition: color 0.1s; }
.typing-text-display .char.correct { color: var(--tool-success); }
.typing-text-display .char.incorrect { color: var(--tool-danger); background: #fce4ec; border-radius: 2px; }
.typing-text-display .char.current { border-left: 2px solid var(--tool-primary); animation: blink 0.8s infinite; }
@keyframes blink { 50% { border-color: transparent; } }

/* ============ TEXT-TO-HANDWRITING ============ */
.handwriting-output {
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  line-height: 1.6;
  padding: 1.5rem;
  background: #fffdf7;
  border: 1px solid #e8e0d0;
  border-radius: 8px;
  min-height: 200px;
  white-space: pre-wrap;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

/* ============ QR CODE ============ */
.qr-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  min-height: 280px;
  background: #f8f9fa;
  border-radius: 12px;
  border: 2px dashed var(--tool-border);
  transition: border-color 0.2s;
}
.qr-container:has(canvas, svg) {
  border-style: solid;
  border-color: var(--tool-primary);
}
.qr-container canvas,
.qr-container svg {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}
.qr-container svg {
  display: block;
}

/* ============ INVOICE GENERATOR ============ */
.logo-preview { max-width: 150px; max-height: 100px; object-fit: contain; border: 1px solid var(--tool-border); border-radius: 6px; }

/* ============ TEXT COUNTER ============ */
.text-counter-textarea { min-height: 200px; resize: vertical; }

/* ============ SLUG GENERATOR ============ */
.slug-preview {
  padding: 0.75rem 1rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  color: #166534;
  word-break: break-all;
}

/* ============ PRINT ============ */
@media print {
  .no-print { display: none !important; }
  .header { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .tool-hero { padding: 1rem 0; }
  .tool-hero .back-link { display: none; }
  .card-section { break-inside: avoid; border: 1px solid #ddd; }
  .tool-card { box-shadow: none; border: 1px solid #ddd; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 767px) {
  .tool-hero { padding: 1.25rem 0; }
  .tool-hero h1 { font-size: 1.25rem; }
  .tool-card-header { padding: 0.8rem 1rem; }
  .tool-card-body { padding: 1rem; }
  .card-section { padding: 1rem; }
  .tool-result-card { padding: 1rem; }
  .tool-stat .value { font-size: 1.1rem; }
}

/* ============ UTILITY WIDTHS ============ */
.w-120px { max-width: 120px !important; }
.w-140px { max-width: 140px !important; }

/* ============ RESULT DISPLAY ============ */
.result-total { font-size: 1.4rem; font-weight: 700; margin-top: 4px; }
.bmi-value { font-size: 2.2rem; font-weight: 700; }
.age-years { font-size: 2rem; font-weight: 700; color: var(--tool-primary); }

/* ============ COLOR DOTS ============ */
.color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }
.color-dot-primary { background: var(--tool-primary); }
.color-dot-accent { background: var(--tool-accent); }

/* ============ TYPING TEST ============ */
.typing-display {
    font-size: 1.1rem; line-height: 1.8; padding: 1.25rem;
    border: 2px solid var(--tool-border); border-radius: 10px; background: #fff;
    font-family: 'Courier New', monospace; min-height: 160px; max-height: 350px;
    user-select: none; cursor: text; overflow-y: auto; word-wrap: break-word; white-space: pre-wrap;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}
.typing-display .correct-char { background: var(--tool-success); color: #fff; border-radius: 2px; }
.typing-display .incorrect-char { background: var(--tool-danger); color: #fff; border-radius: 2px; }
.typing-display .current-char { background: var(--tool-warning); color: #212529; border-radius: 2px; animation: blink 1s infinite; font-weight: bold; }
.stats-card { background: linear-gradient(135deg, var(--tool-primary), var(--tool-primary-dark)); color: #fff; border: none; border-radius: 12px; height: 90px; display: flex; align-items: center; }
.stats-card .card-body { padding: 12px; text-align: center; width: 100%; }
.stats-card h5 { font-size: 0.82rem; margin-bottom: 4px; font-weight: 600; color: rgba(255,255,255,0.85); }
.stats-card h2 { font-size: 1.4rem; margin: 0; font-weight: bold; color: #fff; }
.score-circle { width: 100px; height: 100px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; font-weight: bold; margin: 0 auto; color: #fff; }
.typing-input-hidden { position: absolute; left: -9999px; opacity: 0; }
.leaderboard-item { background: #f8f9fa; border-radius: 10px; padding: 12px; margin: 8px 0; border: 1px solid #e9ecef; }

/* ============ HANDWRITING TOOL ============ */
.handwriting-textarea { font-size: 1rem; line-height: 1.5; padding: 15px; border: 2px solid var(--tool-border); border-radius: 10px; min-height: 150px; resize: vertical; }
.preview-canvas { background: white; border: 2px solid var(--tool-border); border-radius: 10px; margin: 0 auto; box-shadow: 0 4px 12px rgba(0,0,0,0.08); max-width: 100%; }

/* ============ PASSWORD GENERATOR ============ */
.pass-display { font-size: 1.2rem; background: #f8f9fa; text-align: center; font-weight: bold; }

/* ============ MODAL OVERRIDES ============ */
.tool-modal-header { background: linear-gradient(135deg, var(--tool-success), var(--tool-info)); color: #fff; border-radius: 16px 16px 0 0; }
.tool-modal-content { border-radius: 16px; border: none; }

/* ============ CODE EDITOR ============ */
.tool-code-editor {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  min-height: 200px;
  resize: vertical;
  tab-size: 2;
}

/* ============ JSON TREE VIEW ============ */
.json-tree .key { color: #881391; font-weight: 500; }
.json-tree .string { color: #0b7500; }
.json-tree .number { color: #1750eb; }
.json-tree .boolean { color: #0000ff; }
.json-tree .null { color: #9ca3af; font-style: italic; }
.json-tree .toggle {
  cursor: pointer; color: #6b7280; margin-right: 3px;
  font-size: 0.75rem; user-select: none;
  display: inline-block; width: 14px; text-align: center;
}
.json-tree .toggle:hover { color: var(--tool-dark); }
.json-tree .tree-children { padding-left: 1rem; border-left: 1px dashed #e5e7eb; margin-left: 2px; }
.json-tree > div { padding: 1px 0; }
.json-tree .tree-toggle { padding: 1px 0; }

/* ============ DIFF OUTPUT ============ */
.diff-table { width: 100%; border-collapse: collapse; font-family: 'Roboto Mono', monospace; font-size: 0.82rem; }
.diff-table td { padding: 2px 6px; vertical-align: top; white-space: pre-wrap; word-break: break-all; }
.diff-table .diff-ln { width: 40px; min-width: 40px; text-align: right; color: #9ca3af; user-select: none; padding-right: 8px; }
.diff-table .diff-content { width: 100%; padding-left: 8px; }
.diff-table tr.diff-added td { background: #dcfce7; }
.diff-table tr.diff-added .diff-content { border-left: 3px solid #16a34a; }
.diff-table tr.diff-removed td { background: #fee2e2; }
.diff-table tr.diff-removed .diff-content { border-left: 3px solid #dc2626; }
.diff-table tr.diff-unchanged td { background: #fafafa; }
.diff-table tr.diff-unchanged .diff-content { border-left: 3px solid #e5e7eb; }
.diff-table tr.diff-added td.diff-ln { border-left: 3px solid #16a34a; }
.diff-table tr.diff-removed td.diff-ln { border-left: 3px solid #dc2626; }
.diff-table tr.diff-unchanged td.diff-ln { border-left: 3px solid #e5e7eb; }
.diff-badge { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.added-badge { background: #16a34a; }
.removed-badge { background: #dc2626; }
.unchanged-badge { background: #9ca3af; }

/* ============ CASE CONVERTER GRID ============ */
.case-btn { font-family: 'Roboto Mono', monospace; font-size: 0.82rem !important; justify-content: center; }

/* ============ FIELD CHECKBOX GRID ============ */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.4rem;
}
.field-checkbox {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--tool-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.85rem;
  background: #fafafa;
  user-select: none;
}
.field-checkbox:hover {
  border-color: var(--tool-primary);
  background: #f0fdf4;
}
.field-checkbox input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--tool-primary);
  cursor: pointer;
  flex-shrink: 0;
}
.field-checkbox:has(input:checked) {
  border-color: var(--tool-primary);
  background: #f0fdf4;
}
.field-checkbox span { color: var(--tool-dark); }

/* ============ LOREM IPSUM ============ */
#loremOutput { line-height: 1.8; }

/* ============ TOOL INDEX CARDS ============ */
.tool-item .tool-card {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.35s ease;
    height: 100%;
    cursor: pointer;
    position: relative;
}
.tool-item .tool-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12) !important;
}
.tool-item .card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem 1rem;
    font-size: 2.2rem;
    transition: transform 0.3s ease;
}
.tool-item .tool-card:hover .card-icon { transform: scale(1.1); }
.tool-item .card-body { padding: 0 1.25rem 1.25rem; }
.tool-item .card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.4rem; color: var(--tool-dark); }
.tool-item .card-text { font-size: 0.85rem; color: var(--tool-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tool-item .btn-tool {
    border-radius: 50px;
    padding: 0.35rem 1.2rem;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.25s ease;
}
.tool-item .btn-tool:hover { transform: translateX(4px); }
.tool-item .cat-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.7rem;
    border-radius: 50px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}
.search-box {
    border-radius: 50px;
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--tool-border);
    transition: border-color 0.2s;
    font-size: 0.9rem;
}
.search-box:focus {
    border-color: var(--tool-primary);
    box-shadow: 0 0 0 3px rgba(84, 182, 137, 0.15);
    outline: none;
}
.gradient-blue { background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%); color: #0369a1; }
.gradient-green { background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%); color: #15803d; }
.gradient-purple { background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%); color: #7e22ce; }
.gradient-orange { background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%); color: #c2410c; }
.gradient-pink { background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%); color: #be185d; }
.gradient-teal { background: linear-gradient(135deg, #ccfbf1 0%, #99f6e4 100%); color: #0f766e; }
.gradient-red { background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%); color: #b91c1c; }
.gradient-indigo { background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%); color: #4338ca; }
.gradient-yellow { background: linear-gradient(135deg, #fef9c3 0%, #fef08a 100%); color: #a16207; }
.gradient-cyan { background: linear-gradient(135deg, #cffafe 0%, #a5f3fc 100%); color: #0891b2; }
.gradient-rose { background: linear-gradient(135deg, #ffe4e6 0%, #fecdd3 100%); color: #be123c; }
.gradient-amber { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); color: #b45309; }

/* ---- File Share ---- */
.upload-zone {
    border: 2px dashed #d0d5dd;
    border-radius: 12px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s ease;
}
.upload-zone:hover,
.upload-zone-hover {
    border-color: #54B689;
    background: #f0fdf6;
}

