/* ===============================
   DESIGN SYSTEM – TOOLS4ME
   Clean & Professional Enhanced
================================ */

/* -------- ROOT VARIABLES -------- */
:root {
  /* Colors - Primary */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --accent: #10b981;
  --accent-dark: #059669;
  
  /* Colors - Status */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
  
  /* Backgrounds */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-secondary: #f1f5f9;
  --bg-hover: #f8fafc;
  
  /* Text Colors */
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  /* Borders */
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  
  /* Border Radius */
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  
  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 4px 6px rgba(0,0,0,.06);
  --shadow-md: 0 10px 20px rgba(0,0,0,.08);
  --shadow-lg: 0 20px 40px rgba(0,0,0,.12);
  --shadow-focus: 0 0 0 4px rgba(99,102,241,.15);
  
  /* Spacing Scale */
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  
  /* Transitions */
  --transition-fast: .15s ease;
  --transition-base: .25s ease;
  --transition-slow: .35s ease;
  
  /* Z-index Scale */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 1000;
  --z-tooltip: 2000;
}

/* -------- RESET -------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, #f8fafc 0%, #e0e7ff 100%);
  color: var(--text-main);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* -------- CONTAINER -------- */
.container {
  max-width: 1180px;
  margin: auto;
  padding: var(--space-lg);
}

.container-sm {
  max-width: 720px;
  margin: auto;
  padding: var(--space-lg);
}

.container-lg {
  max-width: 1440px;
  margin: auto;
  padding: var(--space-lg);
}

/* -------- HEADER -------- */
.site-header {
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  transition: all var(--transition-base);
}

.site-header.scrolled {
  box-shadow: var(--shadow-md);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
}

.site-header a {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.site-header a:hover {
  color: var(--primary-dark);
}

/* Navigation Links */
.nav-links {
  display: flex;
  gap: var(--space-lg);
  align-items: center;
}

.nav-links a {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.nav-links a:hover {
  color: var(--primary);
  background: var(--bg-hover);
}

/* -------- FOOTER -------- */
.site-footer {
  margin-top: 80px;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  border-top: 1px solid var(--border);
}

.site-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition-fast);
}

.site-footer a:hover {
  color: var(--primary-dark);
}

/* ===============================
   TOOL / PAGE CARD
================================ */
.tool-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-md);
  margin-top: 40px;
  animation: fadeUp .5s ease both;
  border: 1px solid var(--border-light);
}

.tool-box-compact {
  padding: var(--space-lg);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* -------- HEADINGS -------- */
h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text-main);
}

h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-main);
}

h4 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

p {
  color: var(--text-muted);
  margin-bottom: 18px;
}

/* ===============================
   FORM ELEMENTS
================================ */
.form-group {
  margin-bottom: var(--space-lg);
}

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--text-main);
}

label.required::after {
  content: "*";
  color: var(--error);
  margin-left: 4px;
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 15px;
  background: white;
  transition: all var(--transition-fast);
  font-family: inherit;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--primary-light);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--bg-secondary);
  cursor: not-allowed;
  opacity: 0.6;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  margin-right: var(--space-xs);
}

/* Input with icon */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-group input {
  padding-left: 42px;
}

/* ===============================
   BUTTONS
================================ */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  margin-top: 22px;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  font-family: inherit;
}

button:hover,
.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

button:active,
.btn:active {
  transform: translateY(0);
}

button:disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Button Variants */
button.secondary,
.btn-secondary {
  background: linear-gradient(135deg, #64748b, #475569);
}

button.success,
.btn-success {
  background: linear-gradient(135deg, var(--success), var(--accent-dark));
}

button.warning,
.btn-warning {
  background: linear-gradient(135deg, var(--warning), #d97706);
}

button.error,
.btn-error {
  background: linear-gradient(135deg, var(--error), #dc2626);
}

button.outline,
.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

button.outline:hover,
.btn-outline:hover {
  background: var(--primary);
  color: white;
}

button.ghost,
.btn-ghost {
  background: transparent;
  color: var(--primary);
  box-shadow: none;
}

button.ghost:hover,
.btn-ghost:hover {
  background: var(--bg-hover);
}

/* Button Sizes */
.btn-sm {
  padding: 10px 18px;
  font-size: 14px;
}

.btn-lg {
  padding: 18px 30px;
  font-size: 16px;
}

/* ===============================
   ALERTS & MESSAGES
================================ */
.result-box,
.alert {
  margin-top: 22px;
  padding: 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  animation: slideDown .3s ease;
}

.result-box,
.alert-info {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: var(--primary-dark);
  border-left: 4px solid var(--primary);
}

.alert-success {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  color: #166534;
  border-left: 4px solid var(--success);
}

.alert-warning {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  color: #92400e;
  border-left: 4px solid var(--warning);
}

.alert-error {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  color: #991b1b;
  border-left: 4px solid var(--error);
}

/* ===============================
   CARDS & PANELS
================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-header {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.card-body {
  padding: var(--space-md) 0;
}

.card-footer {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

/* ===============================
   TABLES
================================ */
.table-wrapper {
  overflow-x: auto;
  margin-top: var(--space-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
}

td, th {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  text-align: left;
}

th {
  background: #f8fafc;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
}

tr:hover {
  background: var(--bg-hover);
}

tr:last-child td {
  border-bottom: none;
}

/* ===============================
   TOOL GRID (HOMEPAGE)
================================ */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
  margin-top: 40px;
}

.tool-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
  border: 1px solid var(--border-light);
  position: relative;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0);
  transition: transform var(--transition-base);
}

.tool-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.tool-card:hover::before {
  transform: scaleX(1);
}

.tool-card h3 {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 10px;
}

.tool-card p {
  font-size: 14px;
  line-height: 1.6;
}

.tool-card a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  transition: gap var(--transition-fast);
}

.tool-card a:hover {
  gap: 10px;
}

/* ===============================
   BADGES & TAGS
================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-secondary);
  color: var(--text-main);
}

.badge-primary {
  background: var(--primary);
  color: white;
}

.badge-success {
  background: var(--success);
  color: white;
}

.badge-warning {
  background: var(--warning);
  color: white;
}

.badge-error {
  background: var(--error);
  color: white;
}

/* ===============================
   LOADING & SPINNERS
================================ */
.spinner {
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading {
  display: inline-block;
  position: relative;
  opacity: 0.6;
  pointer-events: none;
}

/* ===============================
   CHARTS & VISUALIZATIONS
================================ */
.chart-container {
  position: relative;
  margin-top: 24px;
  padding: var(--space-lg);
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

canvas {
  max-width: 100%;
  height: auto;
}

/* ===============================
   UTILITY CLASSES
================================ */

/* Spacing */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }
.mt-5 { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }
.mb-5 { margin-bottom: var(--space-xl); }

.p-0 { padding: 0; }
.p-1 { padding: var(--space-xs); }
.p-2 { padding: var(--space-sm); }
.p-3 { padding: var(--space-md); }
.p-4 { padding: var(--space-lg); }

/* Text */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-muted { color: var(--text-muted); }
.text-light { color: var(--text-light); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-normal { font-weight: 400; }

.text-sm { font-size: 14px; }
.text-base { font-size: 15px; }
.text-lg { font-size: 18px; }

/* Display */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-xs); }
.gap-2 { gap: var(--space-sm); }
.gap-3 { gap: var(--space-md); }
.gap-4 { gap: var(--space-lg); }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.hidden { display: none; }

/* Borders */
.border { border: 1px solid var(--border); }
.border-top { border-top: 1px solid var(--border); }
.border-bottom { border-bottom: 1px solid var(--border); }
.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 9999px; }

/* Shadows */
.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Width */
.w-full { width: 100%; }
.w-auto { width: auto; }

/* ===============================
   DIVIDERS
================================ */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-lg) 0;
}

.divider-vertical {
  width: 1px;
  height: 100%;
  background: var(--border);
  margin: 0 var(--space-lg);
}

/* ===============================
   PROGRESS BARS
================================ */
.progress {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-full);
  transition: width var(--transition-base);
}

/* ===============================
   TOOLTIPS
================================ */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip-text {
  visibility: hidden;
  background: var(--text-main);
  color: white;
  text-align: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  position: absolute;
  z-index: var(--z-tooltip);
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity var(--transition-base);
  font-size: 13px;
  white-space: nowrap;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* ===============================
   RESPONSIVE
================================ */
@media (max-width: 768px) {
  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 22px;
  }

  .tool-box {
    padding: var(--space-lg);
  }

  .container {
    padding: var(--space-md);
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  button,
  .btn {
    width: 100%;
  }

  .site-header .container {
    flex-wrap: wrap;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
    margin-top: var(--space-xs);
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 24px;
  }

  .tool-card {
    padding: 20px;
  }
}

/* ===============================
   DARK MODE SUPPORT (OPTIONAL)
================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-secondary: #1e293b;
    --bg-hover: #334155;
    
    --text-main: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    
    --border: #334155;
    --border-light: #1e293b;
  }

  body {
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
  }

  input,
  select,
  textarea {
    background: var(--bg-secondary);
    color: var(--text-main);
  }
  
  th {
    background: #1e293b;
  }
}
.worker {
  font-size: 64px;
  animation: bounce 1.2s infinite;
}

.speech {
  display: inline-block;
  margin-top: 12px;
  padding: 14px 18px;
  background: #f1f5f9;
  border-radius: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  animation: fadeUp 0.6s ease;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}