/* ═══════════════════════════════════════════════════════
   MDF Kitchen Calculator – Frontend Styles
   ═══════════════════════════════════════════════════════ */

#mdf-calculator-wrap {
  font-family: 'Vazirmatn', 'Tahoma', sans-serif;
  direction: rtl;
  max-width: 900px;
  margin: 32px auto;
  color: #1e1e2e;
}

.mdf-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #2d2d44;
}

.mdf-subtitle {
  color: #6b7280;
  margin-bottom: 24px;
  font-size: 0.97rem;
}

/* ── Tabs ── */
.mdf-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 0;
}

.mdf-tab {
  background: none;
  border: none;
  padding: 10px 20px;
  font-size: 0.95rem;
  cursor: pointer;
  color: #6b7280;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
  font-family: inherit;
}

.mdf-tab:hover  { color: #4f46e5; }
.mdf-tab.active { color: #4f46e5; border-bottom-color: #4f46e5; font-weight: 600; }

/* ── Tab content ── */
.mdf-tab-content { display: none; }
.mdf-tab-content.active { display: block; }

/* ── Section ── */
.mdf-section {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 20px;
}

.mdf-section h3 {
  margin: 0 0 16px;
  font-size: 1.05rem;
  color: #374151;
}

/* ── Grids ── */
.mdf-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mdf-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.mdf-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

@media (max-width: 640px) {
  .mdf-grid-3, .mdf-grid-4 { grid-template-columns: 1fr 1fr; }
  .mdf-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .mdf-grid-3, .mdf-grid-4, .mdf-grid-2 { grid-template-columns: 1fr; }
}

/* ── Fields ── */
.mdf-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mdf-field label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.mdf-field input[type="number"],
.mdf-field input[type="text"] {
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  background: #fff;
}

.mdf-field input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

.mdf-sub-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.mdf-sub-fields input {
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  font-family: inherit;
}

.mdf-hint {
  color: #6b7280;
  font-size: 0.875rem;
  margin-bottom: 12px;
}

/* ── Cabinet rows ── */
.mdf-cabinet-row {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.mdf-cab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.mdf-cab-type {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

.mdf-type-lower { background: #dbeafe; color: #1d4ed8; }
.mdf-type-upper { background: #d1fae5; color: #065f46; }
.mdf-type-panel { background: #fef3c7; color: #92400e; }

.mdf-remove-cab {
  background: none;
  border: 1px solid #fca5a5;
  color: #ef4444;
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  transition: background 0.15s;
}
.mdf-remove-cab:hover { background: #fee2e2; }

.mdf-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  margin-top: 10px;
  color: #374151;
}

/* ── Add buttons ── */
.mdf-add-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* ── Buttons ── */
.mdf-btn {
  background: #4f46e5;
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  font-family: inherit;
}
.mdf-btn:hover  { background: #4338ca; }
.mdf-btn:active { transform: scale(0.98); }

.mdf-btn-outline {
  background: #fff;
  color: #4f46e5;
  border: 1.5px solid #4f46e5;
  padding: 9px 16px;
  font-size: 0.875rem;
}
.mdf-btn-outline:hover { background: #eef2ff; }

/* ── Loading ── */
#mdf-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  color: #6b7280;
  font-size: 0.95rem;
}

.mdf-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid #e5e7eb;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: mdf-spin 0.7s linear infinite;
}

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

/* ── Result ── */
.mdf-result-box {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px 28px;
  margin-top: 28px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.mdf-result-box h3 {
  font-size: 1.2rem;
  margin: 0 0 20px;
  color: #1e1e2e;
}

.mdf-result-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.mdf-result-card {
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mdf-card-sheets { background: #ede9fe; border: 1px solid #c4b5fd; }
.mdf-card-area   { background: #e0f2fe; border: 1px solid #7dd3fc; }
.mdf-card-price  { background: #d1fae5; border: 1px solid #6ee7b7; }

.mdf-card-icon  { font-size: 1.6rem; }
.mdf-card-label { font-size: 0.8rem; color: #6b7280; font-weight: 600; }
.mdf-card-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1e1e2e;
  line-height: 1.2;
  word-break: break-all;
}
.mdf-card-note  { font-size: 0.75rem; color: #9ca3af; }

.mdf-disclaimer {
  font-size: 0.825rem;
  color: #6b7280;
  border-top: 1px solid #f0f0f0;
  padding-top: 14px;
  margin: 0;
}

.mdf-result-warn {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 0.9rem;
  color: #92400e;
}

.mdf-error-box {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 14px 18px;
  color: #b91c1c;
  font-weight: 600;
  margin-top: 20px;
}
