/* ==========================================================================
   maliya-calculator.css — Общие стили калькуляторов Малийя
   (закят, фитр, конвертер мер)
   ========================================================================== */

/* --- Секция калькулятора --- */
.maliya-calc {
  background: var(--white, #fff);
  border-radius: var(--radius-md, 12px);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.08));
  margin-bottom: 16px;
  overflow: hidden;
}

.maliya-calc-header {
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
  color: var(--dark-gray, #1f2937);
  border-bottom: 1px solid var(--border-gray, #e5e7eb);
  display: flex;
  align-items: center;
  gap: 8px;
}

.maliya-calc-header-icon {
  font-size: 20px;
}

.maliya-calc-body {
  padding: 20px;
}

/* --- Аккордеон --- */
.maliya-accordion {
  border: 1px solid var(--border-gray, #e5e7eb);
  border-radius: var(--radius-md, 12px);
  margin-bottom: 12px;
  overflow: hidden;
  background: var(--white, #fff);
}

.maliya-accordion-trigger {
  width: 100%;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  font-family: var(--font-primary, 'Inter', sans-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--dark-gray, #1f2937);
  cursor: pointer;
  transition: background 0.15s;
  text-align: start;
}

.maliya-accordion-trigger:hover {
  background: var(--emerald-50, #ecfdf5);
}

.maliya-accordion-trigger .acc-icon {
  font-size: 18px;
  margin-inline-end: 10px;
  flex-shrink: 0;
}

.maliya-accordion-trigger .acc-title {
  flex: 1;
}

.maliya-accordion-trigger .acc-chevron {
  width: 20px;
  height: 20px;
  color: var(--medium-gray, #6b7280);
  transition: transform 0.25s;
  flex-shrink: 0;
}

.maliya-accordion.open .acc-chevron {
  transform: rotate(180deg);
}

.maliya-accordion-body {
  display: none;
  padding: 0 20px 20px;
}

.maliya-accordion.open .maliya-accordion-body {
  display: block;
  animation: maliyaAccordionOpen 0.25s ease;
}

@keyframes maliyaAccordionOpen {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Группа полей --- */
.maliya-field-group {
  margin-bottom: 14px;
}

.maliya-field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--medium-gray, #6b7280);
  margin-bottom: 5px;
}

.maliya-field-hint {
  font-size: 11px;
  color: var(--medium-gray, #6b7280);
  opacity: 0.7;
  margin-top: 3px;
}

/* --- Подсказка (?) --- */
.maliya-field-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--emerald-50, #ecfdf5);
  border: 1px solid var(--emerald, #059669);
  color: var(--emerald, #059669);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  vertical-align: middle;
  margin-inline-start: 4px;
  transition: all 0.2s ease;
  user-select: none;
  line-height: 1;
}

.maliya-field-help:hover {
  background: var(--emerald, #059669);
  color: #fff;
}

.maliya-field-tip {
  display: none;
  font-size: 12px;
  line-height: 1.5;
  color: var(--dark-gray, #374151);
  background: var(--emerald-50, #ecfdf5);
  border-inline-start: 3px solid var(--emerald, #059669);
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 6px;
}

.maliya-field-tip.visible {
  display: block;
  animation: tipFadeIn 0.2s ease;
}

@keyframes tipFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Поле ввода --- */
.maliya-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-gray, #e5e7eb);
  border-radius: var(--radius-sm, 8px);
  font-family: var(--font-primary, 'Inter', sans-serif);
  font-size: 14px;
  color: var(--dark-gray, #1f2937);
  background: var(--white, #fff);
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.maliya-input:focus {
  outline: none;
  border-color: var(--emerald, #059669);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--emerald) 10%, transparent);
}

.maliya-input::placeholder {
  color: var(--medium-gray, #6b7280);
  opacity: 0.5;
}

/* Поле с переключателем единиц (грамм/рубли) */
.maliya-input-with-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border-gray, #e5e7eb);
  border-radius: var(--radius-sm, 8px);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.maliya-input-with-toggle:focus-within {
  border-color: var(--emerald, #059669);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--emerald) 10%, transparent);
}

.maliya-input-with-toggle input {
  flex: 1;
  border: none;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-primary, 'Inter', sans-serif);
  color: var(--dark-gray, #1f2937);
  background: transparent;
  outline: none;
  min-width: 0;
}

.maliya-unit-toggle {
  display: flex;
  border-inline-start: 1px solid var(--border-gray, #e5e7eb);
  flex-shrink: 0;
}

.maliya-unit-btn {
  padding: 8px 12px;
  border: none;
  background: var(--light-gray, #f3f4f6);
  color: var(--medium-gray, #6b7280);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.maliya-unit-btn.active {
  background: var(--emerald, #059669);
  color: #fff;
}

.maliya-unit-btn:not(.active):hover {
  background: var(--emerald-50, #ecfdf5);
  color: var(--emerald, #059669);
}

/* --- Радио-кнопки (pill) --- */
.maliya-radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.maliya-radio-pill {
  display: none;
}

.maliya-radio-pill + label {
  padding: 8px 16px;
  border: 1px solid var(--border-gray, #e5e7eb);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--medium-gray, #6b7280);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.maliya-radio-pill:checked + label {
  background: var(--emerald, #059669);
  border-color: var(--emerald, #059669);
  color: #fff;
}

.maliya-radio-pill:not(:checked) + label:hover {
  border-color: var(--emerald, #059669);
  color: var(--emerald, #059669);
  background: var(--emerald-50, #ecfdf5);
}

/* --- Селект --- */
.maliya-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-gray, #e5e7eb);
  border-radius: var(--radius-sm, 8px);
  font-family: var(--font-primary, 'Inter', sans-serif);
  font-size: 14px;
  color: var(--dark-gray, #1f2937);
  background: var(--white, #fff);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-inline-end: 36px;
}

.maliya-select:focus {
  outline: none;
  border-color: var(--emerald, #059669);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--emerald) 10%, transparent);
}

/* --- Блок результата --- */
.maliya-result {
  margin-top: 20px;
  padding: 20px;
  background: var(--emerald-50, #ecfdf5);
  border: 1px solid var(--emerald-100, #d1fae5);
  border-radius: var(--radius-md, 12px);
  animation: maliyaFadeIn 0.3s ease;
}

.maliya-result-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  font-size: 14px;
  color: var(--dark-gray, #1f2937);
}

.maliya-result-row .result-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.maliya-result-row .result-label {
  color: var(--medium-gray, #6b7280);
}

.maliya-result-row .result-value {
  font-weight: 700;
  margin-inline-start: auto;
}

.maliya-result-total {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid var(--emerald, #059669);
  font-size: 18px;
  font-weight: 700;
  color: var(--emerald-dark, #047857);
  display: flex;
  align-items: center;
  gap: 8px;
}

.maliya-result-status {
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm, 8px);
  font-size: 13px;
  font-weight: 600;
}

.maliya-result-status.reached {
  background: var(--emerald, #059669);
  color: #fff;
}

.maliya-result-status.not-reached {
  background: #fef3c7;
  color: #92400e;
}

/* --- Кнопки --- */
.maliya-btn {
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-sm, 8px);
  font-family: var(--font-primary, 'Inter', sans-serif);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  user-select: none;
}

.maliya-btn:active {
  transform: scale(0.97);
}

.maliya-btn-primary {
  background: var(--emerald, #059669);
  color: #fff;
}

.maliya-btn-primary:hover {
  background: var(--emerald-dark, #047857);
}

.maliya-btn-secondary {
  background: var(--light-gray, #f3f4f6);
  color: var(--medium-gray, #6b7280);
  border: 1px solid var(--border-gray, #e5e7eb);
}

.maliya-btn-secondary:hover {
  background: var(--white, #fff);
  border-color: var(--emerald, #059669);
  color: var(--emerald, #059669);
}

.maliya-calc-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* --- Дисклеймер --- */
.maliya-disclaimer {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--light-gray, #f3f4f6);
  border-radius: var(--radius-sm, 8px);
  font-size: 12px;
  line-height: 1.6;
  color: var(--medium-gray, #6b7280);
  border-inline-start: 3px solid var(--border-gray, #e5e7eb);
}

/* --- Таблица подстановки (скот) --- */
.maliya-livestock-result {
  margin-top: 16px;
  padding: 16px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md, 12px);
}

.maliya-livestock-result .livestock-type {
  font-size: 13px;
  color: var(--medium-gray, #6b7280);
  margin-bottom: 4px;
}

.maliya-livestock-result .livestock-zakat {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark-gray, #1f2937);
}

.maliya-livestock-result .livestock-equiv {
  font-size: 13px;
  color: var(--medium-gray, #6b7280);
  margin-top: 4px;
}

.maliya-livestock-result .livestock-disclaimer {
  margin-top: 8px;
  font-size: 11px;
  color: var(--medium-gray, #6b7280);
  font-style: italic;
}

/* --- Конвертер мер --- */
.maliya-converter {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.maliya-converter-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.maliya-converter-row .maliya-input {
  flex: 1;
  min-width: 0;
}

.maliya-converter-row .maliya-select {
  flex: 1.2;
  min-width: 0;
}

.maliya-converter-arrow {
  text-align: center;
  font-size: 24px;
  color: var(--emerald, #059669);
  padding: 4px 0;
  user-select: none;
}

.maliya-converter-info {
  padding: 12px 16px;
  background: var(--emerald-50, #ecfdf5);
  border-radius: var(--radius-sm, 8px);
  font-size: 13px;
  color: var(--dark-gray, #1f2937);
  line-height: 1.6;
}

.maliya-converter-info .conv-formula {
  font-weight: 600;
  direction: ltr;
}

.maliya-converter-info .conv-usage {
  color: var(--medium-gray, #6b7280);
  font-size: 12px;
  margin-top: 4px;
}

.maliya-converter-info .conv-note {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--white, #fff);
  border-inline-start: 3px solid var(--emerald, #10b981);
  border-radius: 0 var(--radius-sm, 8px) var(--radius-sm, 8px) 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--dark-gray, #1f2937);
}

/* --- Стоимость в валюте --- */
.maliya-converter-info .conv-price {
  margin-top: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--amber-50, #fffbeb), #fff8e1);
  border-inline-start: 3px solid var(--gold, #d4a843);
  border-radius: 0 var(--radius-sm, 8px) var(--radius-sm, 8px) 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--dark-gray, #1f2937);
}

.maliya-converter-info .conv-price b {
  color: var(--emerald-dark, #047857);
}

/* --- Вводный текст конвертера --- */
.maliya-measures-intro {
  margin-bottom: 20px;
  padding: 14px 18px;
  background: var(--amber-50, #fffbeb);
  border-radius: var(--radius-sm, 8px);
  border-inline-start: 3px solid var(--gold, #c5a059);
  font-size: 13px;
  line-height: 1.7;
  color: var(--dark-gray, #1f2937);
}

/* --- Раскрывающийся блок пояснения --- */
.conv-details {
  margin-top: 12px;
  border-radius: var(--radius-sm, 8px);
  overflow: hidden;
}

.conv-details summary {
  padding: 8px 12px;
  background: var(--white, #fff);
  border: 1px solid var(--border-gray, #e5e7eb);
  border-radius: var(--radius-sm, 8px);
  font-size: 13px;
  font-weight: 500;
  color: var(--emerald, #10b981);
  cursor: pointer;
  transition: background 0.2s;
  list-style: none;
}

.conv-details summary::-webkit-details-marker {
  display: none;
}

.conv-details summary::before {
  content: '▸ ';
  display: inline;
  transition: transform 0.2s;
}

.conv-details[open] summary::before {
  content: '▾ ';
}

.conv-details summary:hover {
  background: var(--emerald-50, #ecfdf5);
}

.conv-details-body {
  padding: 14px 16px;
  background: var(--white, #fff);
  border: 1px solid var(--border-gray, #e5e7eb);
  border-top: none;
  border-radius: 0 0 var(--radius-sm, 8px) var(--radius-sm, 8px);
  font-size: 13px;
  line-height: 1.75;
  color: var(--dark-gray, #1f2937);
}

.conv-details-body p {
  margin: 0 0 8px;
}

.conv-details-body p:last-child {
  margin-bottom: 0;
}

.conv-details-body ol {
  margin: 6px 0 8px 20px;
  padding: 0;
}

.conv-details-body ol li {
  margin-bottom: 4px;
}

.conv-desc-dalil {
  padding: 8px 12px;
  background: var(--amber-50, #fffbeb);
  border-radius: var(--radius-xs, 6px);
  border-inline-start: 3px solid var(--gold, #c5a059);
}

.conv-desc-dalil .arabic-inline {
  display: inline;
  font-family: 'Scheherazade New', 'Amiri', serif;
  font-size: 15px;
  line-height: 2;
  color: var(--dark-gray, #1f2937);
}

.conv-desc-rel {
  padding: 6px 10px;
  background: var(--light-gray, #f9fafb);
  border-radius: var(--radius-xs, 6px);
  font-family: 'Inter', monospace;
  font-size: 12.5px;
}

.conv-desc-src {
  font-size: 11.5px;
  color: var(--medium-gray, #6b7280);
  font-style: italic;
  margin-top: 6px;
}

/* --- Справочная таблица единиц --- */
.maliya-measures-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  font-size: 13px;
}

.maliya-measures-table th {
  background: var(--emerald-50, #ecfdf5);
  padding: 10px 12px;
  text-align: start;
  font-weight: 600;
  color: var(--emerald-dark, #047857);
  border-bottom: 2px solid var(--emerald, #059669);
}

.maliya-measures-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-gray, #e5e7eb);
  color: var(--dark-gray, #1f2937);
}

.maliya-measures-table tr:hover td {
  background: var(--light-gray, #f3f4f6);
}

.maliya-measures-table .measure-arabic {
  font-family: var(--font-arabic, 'Scheherazade New', serif);
  font-size: 1.1rem;
  direction: rtl;
}

.maliya-measures-table .measure-category {
  background: var(--light-gray, #f3f4f6);
  font-weight: 600;
  color: var(--emerald, #059669);
}

/* --- Секция статей (вакф, муамалят, курбан) --- */
.maliya-articles-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.maliya-article-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--white, #fff);
  border: 1px solid var(--border-gray, #e5e7eb);
  border-radius: var(--radius-md, 12px);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.maliya-article-card:hover {
  border-color: var(--emerald, #059669);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--emerald) 10%, transparent);
}

.maliya-article-card .article-title {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--dark-gray, #1f2937);
}

.maliya-article-card .article-title-ar {
  font-family: var(--font-arabic, 'Scheherazade New', serif);
  font-size: 1rem;
  color: var(--medium-gray, #6b7280);
  direction: rtl;
}

.maliya-article-card .article-arrow {
  color: var(--medium-gray, #6b7280);
  flex-shrink: 0;
  transition: color 0.15s;
}

.maliya-article-card:hover .article-arrow {
  color: var(--emerald, #059669);
}

.maliya-section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--dark-gray, #1f2937);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.maliya-empty-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--medium-gray, #6b7280);
  font-size: 14px;
}

.maliya-empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

/* ==========================================================================
   Фидья — специфические стили
   ========================================================================== */

/* --- Масаили (раскрывающийся блок) --- */
.maliya-masail-details {
  cursor: pointer;
}

.maliya-masail-summary {
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--dark-gray, #1f2937);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.maliya-masail-summary::-webkit-details-marker {
  display: none;
}

.maliya-masail-summary::after {
  content: '▸';
  margin-inline-start: auto;
  transition: transform 0.2s;
  font-size: 14px;
  color: var(--medium-gray, #6b7280);
}

.maliya-masail-details[open] .maliya-masail-summary::after {
  transform: rotate(90deg);
}

.maliya-masail-content {
  padding: 0 20px 20px;
}

.maliya-masail-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-gray, #e5e7eb);
}

.maliya-masail-item:last-child {
  border-bottom: none;
}

.maliya-masail-num {
  font-weight: 600;
  font-size: 13px;
  color: var(--emerald, #059669);
  margin-bottom: 4px;
}

.maliya-masail-text {
  font-size: 13px;
  line-height: 1.7;
  color: var(--dark-gray, #1f2937);
}

/* --- Сетка намазов (ввод по отдельности) --- */
.maliya-fidya-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.maliya-fidya-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.maliya-field-label--small {
  font-size: 12px !important;
  margin-bottom: 0 !important;
}

/* --- Чекбоксы --- */
.maliya-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.maliya-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--dark-gray, #1f2937);
  cursor: pointer;
}

.maliya-checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--emerald, #059669);
}

/* --- Premium бейдж --- */
.maliya-premium-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  letter-spacing: 0.5px;
  vertical-align: middle;
}

/* --- Результат: доп элементы --- */
.maliya-result-header {
  font-weight: 600;
  font-size: 15px;
  color: var(--dark-gray, #1f2937);
  margin-bottom: 12px;
}

.maliya-result-divider {
  border-top: 1px solid var(--border-gray, #d1d5db);
  margin: 8px 0;
}

.maliya-result-breakdown {
  font-size: 12px;
  color: var(--medium-gray, #6b7280);
  padding-inline-start: 28px;
  margin-top: -4px;
  margin-bottom: 4px;
}

.maliya-result-formula {
  font-size: 12px;
  color: var(--medium-gray, #6b7280);
  font-weight: normal;
  margin-top: 4px;
}

.maliya-result-row--hayd {
  color: var(--emerald, #059669);
}

.maliya-result-note {
  font-size: 12px;
  color: var(--medium-gray, #6b7280);
  padding-inline-start: 28px;
  margin-top: -2px;
  margin-bottom: 6px;
  font-style: italic;
}

/* --- Кнопки действий (печать, помощь) --- */
.maliya-fidya-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.maliya-btn-accent {
  background: linear-gradient(135deg, #059669, #047857);
  color: #fff;
  border-color: transparent;
}

.maliya-btn-accent:hover {
  background: linear-gradient(135deg, #047857, #065f46);
}

/* --- Каффара заглушка --- */
.maliya-kaffara-stub {
  font-size: 14px;
  line-height: 1.7;
  color: var(--medium-gray, #6b7280);
}

.maliya-kaffara-stub p {
  margin: 0 0 10px;
}

.maliya-kaffara-stub p:last-child {
  margin-bottom: 0;
}

.maliya-link {
  color: var(--emerald, #059669);
  text-decoration: none;
}

.maliya-link:hover {
  text-decoration: underline;
}

/* --- Форма заявки --- */
.maliya-fidya-help-form .maliya-field-group {
  margin-bottom: 16px;
}

.maliya-fidya-success {
  padding: 24px;
  text-align: center;
}

/* --- Адаптивность --- */
@media (max-width: 640px) {
  .maliya-fidya-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .maliya-fidya-actions {
    flex-direction: column;
  }
}
