/* ==========================================================================
   MultiToolKit - Tool Workspace & Dedicated Interactive Controls
   ========================================================================== */

/* Breadcrumb Navigation */
.breadcrumb-nav {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  margin-bottom: 2rem;
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.breadcrumb-list a {
  color: var(--text-secondary);
}

.breadcrumb-list a:hover {
  color: var(--primary);
}

.breadcrumb-separator {
  color: var(--border-color);
}

/* Tool Header Block */
.tool-page-header {
  margin-bottom: 2rem;
}

.tool-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--secondary);
  background: var(--primary-light);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  margin-bottom: 0.75rem;
}

.tool-page-title {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.tool-page-lead {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 800px;
}

/* Tool Workspace Container */
.tool-workspace {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  margin-bottom: 3rem;
  transition: box-shadow var(--transition-normal);
}

/* Form Groups & Controls */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--input-radius);
  font-size: 0.95rem;
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--ring-focus);
  background-color: var(--bg-surface);
}

textarea.form-control {
  resize: vertical;
  min-height: 140px;
  font-family: inherit;
  line-height: 1.6;
}

textarea.font-mono {
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.input-group {
  display: flex;
  align-items: stretch;
}

.input-addon {
  display: flex;
  align-items: center;
  padding: 0 1rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.input-addon:first-child {
  border-right: none;
  border-radius: var(--input-radius) 0 0 var(--input-radius);
}

.input-addon:last-child {
  border-left: none;
  border-radius: 0 var(--input-radius) var(--input-radius) 0;
}

/* Segmented & Toggle Controls */
.segmented-control {
  display: inline-flex;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--btn-radius);
  padding: 0.25rem;
  gap: 0.25rem;
  max-width: 100%;
  overflow-x: auto;
}

.segmented-btn {
  padding: 0.45rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 6px;
  color: var(--text-secondary);
  background: transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.segmented-btn:hover {
  color: var(--text-primary);
}

.segmented-btn.active {
  background-color: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .segmented-btn.active {
  color: var(--secondary);
}

/* Checkbox and Radio Modern Styling */
.checkbox-label, .radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.92rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"],
.radio-label input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Tool Actions Bar */
.tool-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

.actions-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Drag & Drop File Upload Zone */
.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--card-radius);
  background-color: var(--bg-primary);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--secondary);
  background-color: var(--primary-light);
}

.dropzone-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  color: var(--secondary);
}

.dropzone-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.dropzone-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.dropzone input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* File Queue / Reorder List */
.file-queue {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--btn-radius);
  gap: 1rem;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
}

.file-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  color: var(--primary);
  border-color: var(--secondary);
}

.btn-icon.danger:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* Live Stats & Metrics Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--btn-radius);
  padding: 1rem;
  text-align: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

[data-theme="dark"] .stat-value {
  color: var(--secondary);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

/* Password Strength Bar */
.strength-meter {
  height: 6px;
  background-color: var(--bg-tertiary);
  border-radius: 9999px;
  overflow: hidden;
  margin: 0.75rem 0 0.5rem;
}

.strength-bar {
  height: 100%;
  width: 0%;
  transition: width var(--transition-normal), background-color var(--transition-normal);
}

.strength-bar.weak { width: 25%; background-color: var(--danger); }
.strength-bar.fair { width: 50%; background-color: var(--warning); }
.strength-bar.good { width: 75%; background-color: var(--secondary); }
.strength-bar.strong { width: 100%; background-color: var(--success); }

/* Color Swatches Grid */
.color-swatches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.swatch-card {
  border: 1px solid var(--border-color);
  border-radius: var(--btn-radius);
  overflow: hidden;
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.swatch-card:hover {
  transform: translateY(-2px);
}

.swatch-color {
  height: 80px;
  width: 100%;
}

.swatch-meta {
  padding: 0.6rem;
  text-align: center;
}

.swatch-code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
}

.swatch-name {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Image Tool Split & Previews */
.preview-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--btn-radius);
  min-height: 280px;
  max-height: 480px;
  padding: 1rem;
  overflow: hidden;
  position: relative;
}

.preview-stage img,
.preview-stage canvas {
  max-width: 100%;
  max-height: 440px;
  object-fit: contain;
  border-radius: 4px;
}

/* Calculation Results Card */
.calc-results-card {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 1.75rem;
  margin-top: 1.5rem;
}

.calc-headline-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
  margin: 0.25rem 0 0.75rem;
}

[data-theme="dark"] .calc-headline-value {
  color: var(--secondary);
}

.calc-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.92rem;
}

.calc-breakdown-table th,
.calc-breakdown-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.calc-breakdown-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
}

.calc-breakdown-table td:last-child {
  text-align: right;
  font-weight: 700;
}

/* Amortization Schedule Table Container */
.schedule-table-wrapper {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--btn-radius);
  margin-top: 1.25rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th {
  position: sticky;
  top: 0;
  background-color: var(--bg-secondary);
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
}

.data-table td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.data-table tr:hover td {
  background-color: var(--bg-secondary);
}

/* Invoice Sheet Styles */
.invoice-paper {
  background-color: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 2.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  max-width: 800px;
  margin: 1.5rem auto 0;
}

[data-theme="dark"] .invoice-paper {
  background-color: #ffffff;
  color: #0f172a;
}

.invoice-header-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid #e2e8f0;
}

.invoice-meta-table td {
  padding: 0.25rem 0.5rem;
}

.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.invoice-items-table th {
  background-color: #f8fafc;
  border-bottom: 2px solid #cbd5e1;
  padding: 0.65rem 0.75rem;
  text-align: left;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: #475569;
}

.invoice-items-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid #e2e8f0;
}

/* Educational & Guide Content Sections */
.tool-guide-section {
  margin-top: 3.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border-color);
}

.guide-block {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 2rem;
  margin-bottom: 2rem;
}

.guide-block h3 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.guide-block p, .guide-block li {
  color: var(--text-secondary);
  line-height: 1.7;
}

.guide-steps-list {
  list-style: none;
  counter-reset: step-counter;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.guide-steps-list li {
  counter-increment: step-counter;
  position: relative;
  padding-left: 2.5rem;
}

.guide-steps-list li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--primary);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.example-box {
  background-color: var(--bg-primary);
  border-left: 4px solid var(--secondary);
  padding: 1.25rem 1.5rem;
  border-radius: 0 var(--btn-radius) var(--btn-radius) 0;
  margin: 1.25rem 0;
}

.example-box h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

/* Related Tools */
.related-tools-section {
  margin-top: 3rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border-color);
}

/* Print Styles for Invoices and Documents */
@media print {
  body * {
    visibility: hidden;
  }
  .invoice-paper, .invoice-paper * {
    visibility: visible;
  }
  .invoice-paper {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border: none;
  }
  .site-header, .site-footer, .breadcrumb-nav, .tool-actions-bar, .ad-slot-container {
    display: none !important;
  }
}
