/* ========================================
   Tools4Cool - Main Stylesheet
   ======================================== */

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    "Kanit",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
  color: #222;
  line-height: 1.7;
}

/* ========================================
   Header
   ======================================== */
.header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 0 48px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 20px;
  font-weight: 600;
  color: #111;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: #222;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon svg {
  width: 20px;
  height: 20px;
  color: #fff;
}

.nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav a {
  color: #555;
  text-decoration: none;
  font-size: 15px;
  font-weight: 400;
  transition: color 0.2s;
}

.nav a:hover {
  color: #000;
}

.nav a.active {
  color: #000;
  font-weight: 500;
}

/* ========================================
   Footer
   ======================================== */
.footer {
  text-align: center;
  padding: 32px;
  color: #888;
  font-size: 13px;
}

/* ========================================
   Container & Layout
   ======================================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px;
}

.container-narrow {
  max-width: 900px;
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
  text-align: center;
  margin-bottom: 48px;
}

.hero h1 {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #111;
}

.hero p {
  font-size: 16px;
  color: #666;
}

/* ========================================
   Typography
   ======================================== */
h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
}
h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 24px;
  color: #111;
}
h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 16px 0;
  color: #111;
}

.subtitle {
  color: #666;
  margin-bottom: 32px;
  font-size: 14px;
}
.section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 24px;
  color: #111;
}

/* ========================================
   Links
   ======================================== */
.help-link,
.back-link {
  color: #0066cc;
  text-decoration: none;
}

.help-link:hover,
.back-link:hover {
  text-decoration: underline;
}

/* ========================================
   Tools Grid (Homepage)
   ======================================== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.tool-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 28px;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.tool-card:hover {
  border-color: #ccc;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.tool-icon {
  width: 48px;
  height: 48px;
  background: #f5f5f5;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.tool-icon svg {
  width: 24px;
  height: 24px;
  color: #333;
}

.tool-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #111;
}

.tool-card p {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
}

.tool-card.coming-soon {
  opacity: 0.6;
  cursor: not-allowed;
}

.tool-card.coming-soon:hover {
  transform: none;
  box-shadow: none;
  border-color: #e0e0e0;
}

/* ========================================
   Badges
   ======================================== */
.badge {
  display: inline-block;
  padding: 3px 8px;
  background: #f0f0f0;
  color: #888;
  font-size: 11px;
  border-radius: 4px;
  margin-left: 8px;
  font-weight: 500;
}

.badge.active {
  background: #e8f5e9;
  color: #2e7d32;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.btn-primary {
  background: #222;
  color: #fff;
}

.btn-primary:hover {
  background: #000;
}

.btn-primary:disabled {
  background: #888;
  cursor: not-allowed;
}

.btn-secondary {
  background: #fff;
  color: #222;
  border: 1px solid #ddd;
}

.btn-secondary:hover {
  background: #f5f5f5;
}

.btn-group {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.btn-recheck {
  padding: 4px 10px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}

.btn-recheck:hover:not(:disabled) {
  background: #f5f5f5;
}

.btn-recheck:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ========================================
   Forms & Upload
   ======================================== */
.upload-section {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 32px;
}

.upload-area {
  border: 2px dashed #ccc;
  border-radius: 6px;
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-area:hover {
  border-color: #888;
  background: #fafafa;
}

.upload-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
}

.upload-text {
  font-size: 15px;
  margin-bottom: 8px;
}

.upload-hint {
  font-size: 13px;
  color: #888;
}

input[type="file"] {
  display: none;
}

/* ========================================
   Messages & Alerts
   ======================================== */
.error-msg {
  background: #fee;
  border: 1px solid #fcc;
  color: #c00;
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 24px;
}

.file-info {
  background: #f8f8f8;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ========================================
   Loading Indicators
   ======================================== */
.loading-indicator {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #f8f8f8;
  border-radius: 6px;
  font-size: 14px;
  color: #666;
  margin-bottom: 24px;
}

.loading-indicator.show {
  display: flex;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #ddd;
  border-top-color: #333;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========================================
   Tables
   ======================================== */
.table-container {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th {
  background: #f8f8f8;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid #e0e0e0;
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}

tr:hover {
  background: #fafafa;
}

tr.checking {
  background: #f8f8f8;
}

.debug-header {
  background: #e3f2fd !important;
}

/* ========================================
   URL & Status Cells
   ======================================== */
.url-cell {
  max-width: 250px;
  word-break: break-all;
  font-family: monospace;
  font-size: 11px;
}

.url-cell a {
  color: #0066cc;
  text-decoration: none;
}

.url-cell a:hover {
  text-decoration: underline;
}

.redirect-url {
  font-family: monospace;
  font-size: 10px;
  color: #666;
  word-break: break-all;
  max-width: 200px;
}

.redirect-url a {
  color: #0066cc;
  text-decoration: none;
}

.remark-cell {
  font-size: 11px;
  color: #666;
  max-width: 200px;
}

/* ========================================
   Status Badges
   ======================================== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.status-correct {
  background: #e8f5e9;
  color: #2e7d32;
}

.status-incorrect {
  background: #ffebee;
  color: #c62828;
}

/* HTTP Status Badges */
.http-status {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  font-family: monospace;
}

.http-2xx {
  background: #e8f5e9;
  color: #2e7d32;
}

.http-3xx {
  background: #fff8e1;
  color: #e65100;
}

.http-4xx {
  background: #ffebee;
  color: #c62828;
}

.http-5xx {
  background: #fce4ec;
  color: #ad1457;
}

/* ========================================
   Content Box
   ======================================== */
.content {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 32px;
}

/* ========================================
   Steps (How-to-use)
   ======================================== */
.step {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid #eee;
}

.step:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #222;
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 500;
  margin-right: 12px;
}

.step-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
}

.step-content {
  margin-left: 40px;
  color: #444;
  font-size: 14px;
}

.step-content p {
  margin-bottom: 10px;
}

.step-content ul {
  margin-left: 20px;
  margin-top: 8px;
}

/* CSV Example Box */
.csv-example {
  background: #f8f8f8;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 16px;
  font-family: monospace;
  font-size: 13px;
  margin: 12px 0;
  overflow-x: auto;
}

.csv-example .header {
  color: #0066cc;
  font-weight: 600;
}

.csv-example .row {
  color: #666;
}

/* Table Info (Definition List) */
.table-info {
  margin-left: 0;
}

.table-info dt {
  font-weight: 500;
  color: #222;
  margin-top: 16px;
  margin-bottom: 4px;
}

.table-info dt:first-child {
  margin-top: 0;
}

.table-info dd {
  color: #555;
  font-size: 14px;
  margin-left: 0;
  padding-left: 16px;
  border-left: 3px solid #e0e0e0;
}

.table-info dd ul {
  margin-top: 8px;
  margin-left: 16px;
}

/* Code */
code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 13px;
}

/* ========================================
   Icons
   ======================================== */
.icon {
  width: 14px;
  height: 14px;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
  .header {
    padding: 0 24px;
  }

  .container {
    padding: 24px;
  }

  .nav {
    gap: 16px;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 24px;
  }

  .btn-group {
    flex-wrap: wrap;
  }
}
