/* ─── Maha Tool - Tool Page Stylesheet ──────────────────────────────────── */

/* ─── Tool-specific variables (extend global style.css) ─────────────────── */
:root {
  --ag-success:      #16a34a;
  --ag-danger:       #dc2626;
  --ag-warning:      #d97706;
  --ag-bg-soft:      #f8fafc;
  --ag-shadow-hover: 0 8px 30px rgba(67,97,238,0.18);
}

/* ─── Tool page layout ───────────────────────────────────────────────────── */
.ag-main {
  min-height: calc(100vh - var(--ag-header-h, 64px));
  padding: 32px 0 64px;
}
.ag-tool-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}
.ag-tool-page-wide {
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ─── Tool header (icon + title + desc) ──────────────────────────────────── */
.ag-tool-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
}
.ag-tool-header-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--ag-radius, 12px);
  background: var(--ag-accent-light, #eef1fd);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ag-tool-header-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--ag-text, #1e2d3d);
  line-height: 1.2;
  margin-bottom: 6px;
}
.ag-tool-header-desc {
  font-size: 15px;
  color: var(--ag-text-muted, #6c7a8d);
  line-height: 1.5;
}

/* ─── Tool component wrapper ─────────────────────────────────────────────── */
.ag-tool-wrap {
  margin-bottom: 32px;
}

/* ─── Related tools (compact grid variant) ───────────────────────────────── */
.ag-tools-grid-sm {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

/* ─── Coming soon placeholder ────────────────────────────────────────────── */
.ag-coming-soon {
  text-align: center;
  padding: 60px 24px;
  color: var(--ag-text-muted, #6c7a8d);
}
.ag-coming-soon h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--ag-text, #1e2d3d);
  margin: 16px 0 8px;
}
.ag-coming-soon p {
  font-size: 14px;
}

/* ─── Tool box (main work area) ──────────────────────────────────────────── */
.ag-tool-box {
  background: #fff;
  border: 1px solid var(--ag-border, #e8ecf0);
  border-radius: var(--ag-radius, 12px);
  overflow: hidden;
  box-shadow: var(--ag-shadow, 0 2px 16px rgba(67,97,238,.09));
  margin-bottom: 28px;
}
.ag-tool-box-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--ag-border, #e8ecf0);
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fafbff;
}
.ag-tool-box-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ag-text, #1e2d3d);
}
.ag-tool-box-body { padding: 28px 24px; }
.ag-tool-box-body-sm { padding: 20px; }

/* ─── Upload area ────────────────────────────────────────────────────────── */
.ag-upload-area {
  border: 2px dashed var(--ag-accent, #4361ee);
  border-radius: var(--ag-radius, 12px);
  padding: 52px 24px;
  text-align: center;
  cursor: pointer;
  transition: .2s ease;
  background: #fafbff;
  position: relative;
}
.ag-upload-area:hover,
.ag-upload-area.ag-dragover {
  background: var(--ag-accent-light, #eef1fd);
  border-color: var(--ag-accent-dark, #3451d1);
}
.ag-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.ag-upload-icon-wrap {
  width: 64px;
  height: 64px;
  background: var(--ag-accent-light, #eef1fd);
  color: var(--ag-accent, #4361ee);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.ag-upload-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ag-text, #1e2d3d);
  margin-bottom: 6px;
}
.ag-upload-sub {
  font-size: 13px;
  color: var(--ag-text-muted, #6c7a8d);
}
.ag-upload-sub strong { color: var(--ag-accent, #4361ee); }
.ag-upload-limit {
  font-size: 12px;
  color: var(--ag-text-light, #9aa5b4);
  margin-top: 8px;
}

/* ─── File list ──────────────────────────────────────────────────────────── */
.ag-file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}
.ag-file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8f9fc;
  border: 1px solid var(--ag-border, #e8ecf0);
  border-radius: var(--ag-radius-sm, 6px);
  padding: 12px 14px;
}
.ag-file-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--ag-radius-sm, 6px);
  background: var(--ag-accent-light, #eef1fd);
  color: var(--ag-accent, #4361ee);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ag-file-info { flex: 1; min-width: 0; }
.ag-file-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ag-text, #1e2d3d);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ag-file-size { font-size: 12px; color: var(--ag-text-muted, #6c7a8d); margin-top: 2px; }
.ag-file-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ag-text-muted, #6c7a8d);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: .15s;
  flex-shrink: 0;
}
.ag-file-remove:hover { color: #ef4444; background: #fef2f2; }

/* ─── Progress bar ───────────────────────────────────────────────────────── */
.ag-progress-wrap {
  background: var(--ag-border, #e8ecf0);
  border-radius: 50px;
  height: 6px;
  overflow: hidden;
  margin: 16px 0;
}
.ag-progress-bar {
  height: 100%;
  background: var(--ag-accent, #4361ee);
  border-radius: 50px;
  transition: width .3s ease;
  width: 0%;
}
.ag-progress-text {
  font-size: 13px;
  color: var(--ag-text-muted, #6c7a8d);
  text-align: center;
  margin-top: 8px;
}

/* ─── Result area ────────────────────────────────────────────────────────── */
.ag-result-wrap {
  border: 1px solid var(--ag-border, #e8ecf0);
  border-radius: var(--ag-radius, 12px);
  overflow: hidden;
  margin-top: 24px;
}
.ag-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #f8f9fc;
  border-bottom: 1px solid var(--ag-border, #e8ecf0);
  gap: 10px;
}
.ag-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ag-text, #1e2d3d);
}
.ag-result-body { padding: 20px; }

/* ─── Options / controls ─────────────────────────────────────────────────── */
.ag-tool-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.ag-opt-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ag-opt-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ag-text, #1e2d3d);
}
.ag-opt-input,
.ag-opt-select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--ag-border, #e8ecf0);
  border-radius: var(--ag-radius-sm, 6px);
  font-size: 14px;
  font-family: var(--ag-font, 'Outfit', sans-serif);
  color: var(--ag-text, #1e2d3d);
  background: #fff;
  outline: none;
  transition: .2s;
}
.ag-opt-input:focus,
.ag-opt-select:focus {
  border-color: var(--ag-accent, #4361ee);
  box-shadow: 0 0 0 3px rgba(67,97,238,.1);
}
.ag-opt-range {
  width: 100%;
  accent-color: var(--ag-accent, #4361ee);
}

/* ─── Tool action buttons ────────────────────────────────────────────────── */
.ag-tool-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* ─── Code textarea (for dev tools) ─────────────────────────────────────── */
.ag-code-wrap {
  position: relative;
}
.ag-code-area {
  width: 100%;
  min-height: 240px;
  padding: 14px 16px;
  border: 1.5px solid var(--ag-border, #e8ecf0);
  border-radius: var(--ag-radius-sm, 6px);
  font-family: 'Courier New', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ag-text, #1e2d3d);
  background: #f8f9fc;
  resize: vertical;
  outline: none;
  transition: .2s;
}
.ag-code-area:focus {
  border-color: var(--ag-accent, #4361ee);
  box-shadow: 0 0 0 3px rgba(67,97,238,.1);
}
.ag-code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,.9);
  border: 1px solid var(--ag-border, #e8ecf0);
  color: var(--ag-text-muted, #6c7a8d);
  padding: 5px 10px;
  border-radius: var(--ag-radius-sm, 6px);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: .2s;
  font-family: var(--ag-font, 'Outfit', sans-serif);
}
.ag-code-copy:hover { background: #fff; color: var(--ag-accent, #4361ee); }

/* ─── Calculator result display ──────────────────────────────────────────── */
.ag-calc-result {
  background: linear-gradient(135deg, var(--ag-accent, #4361ee) 0%, #3a0ca3 100%);
  border-radius: var(--ag-radius, 12px);
  padding: 28px;
  color: #fff;
  text-align: center;
  margin-top: 24px;
}
.ag-calc-result-label {
  font-size: 14px;
  opacity: .85;
  margin-bottom: 8px;
}
.ag-calc-result-value {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -.5px;
  margin-bottom: 4px;
}
.ag-calc-result-sub { font-size: 13px; opacity: .8; }

.ag-calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 20px;
}
.ag-calc-table th {
  background: #f8f9fc;
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: var(--ag-text-muted, #6c7a8d);
  border-bottom: 1px solid var(--ag-border, #e8ecf0);
}
.ag-calc-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--ag-border, #e8ecf0);
  color: var(--ag-text, #1e2d3d);
}
.ag-calc-table tr:last-child td { border-bottom: none; font-weight: 700; }

/* ─── Two-column tool layout ─────────────────────────────────────────────── */
.ag-tool-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

/* ─── SEO content (bottom of tool pages) ────────────────────────────────── */
.ag-seo-content {
  background: #fff;
  border: 1px solid var(--ag-border, #e8ecf0);
  border-radius: var(--ag-radius, 12px);
  padding: 36px 32px;
  margin-top: 40px;
}
.ag-seo-content h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--ag-text, #1e2d3d);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ag-border, #e8ecf0);
}
.ag-seo-content h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ag-text, #1e2d3d);
  margin: 22px 0 10px;
}
.ag-seo-content p {
  font-size: 15px;
  color: #374151;
  line-height: 1.75;
  margin-bottom: 14px;
}
.ag-seo-content ul {
  padding-left: 22px;
  margin-bottom: 16px;
}
.ag-seo-content li {
  font-size: 15px;
  color: #374151;
  margin-bottom: 8px;
  list-style: disc;
  line-height: 1.6;
}
.ag-seo-content ol {
  padding-left: 22px;
  margin-bottom: 16px;
}
.ag-seo-content ol li { list-style: decimal; }
.ag-seo-content h2:first-child { margin-top: 0; }
.ag-seo-content strong { font-weight: 600; color: var(--ag-text, #1e2d3d); }

/* ─── Related tools ──────────────────────────────────────────────────────── */
.ag-related-tools {
  margin-top: 40px;
}
.ag-related-tools h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--ag-text, #1e2d3d);
}
.ag-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

/* ─── Rating widget ──────────────────────────────────────────────────────── */
.ag-rating-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  border-top: 1px solid var(--ag-border, #e8ecf0);
  margin-top: 20px;
}
.ag-rating-label { font-size: 14px; color: var(--ag-text-muted, #6c7a8d); }
.ag-stars {
  display: flex;
  gap: 4px;
}
.ag-star {
  background: none;
  border: none;
  cursor: pointer;
  color: #d1d5db;
  font-size: 22px;
  transition: .15s;
  padding: 0;
  line-height: 1;
}
.ag-star.ag-filled,
.ag-star:hover,
.ag-star:hover ~ .ag-star { color: #f59e0b; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .ag-tool-page { padding: 20px 16px 48px; }
  .ag-tool-cols { grid-template-columns: 1fr; }
  .ag-tool-box-body { padding: 20px 16px; }
  .ag-upload-area { padding: 36px 16px; }
  .ag-seo-content { padding: 24px 18px; }
  .ag-calc-result-value { font-size: 28px; }
  .ag-tool-header { gap: 12px; }
  .ag-tool-header-icon { width: 44px; height: 44px; }
  .ag-tool-header-title { font-size: 22px; }
  .ag-tools-grid-sm { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .ag-related-tools { margin-top: 28px; }
}
