/* ════════════════════════════════════════════════════════════════
   Avukat Hesaplama Araçları — Paylaşılan Stiller (Mobile-First)
   Tüm shortcode kalıbı ortak kullanır.
   ════════════════════════════════════════════════════════════════ */

/* Container — responsive padding, max-width with safe margins */
.calc-container {
    max-width: 680px;
    margin: 1.5rem auto;
    padding: 0 1rem;
    font-family: var(--font-family, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
    color: var(--text-color, #111827);
    line-height: 1.5;
    box-sizing: border-box;
}
.calc-container *, .calc-container *::before, .calc-container *::after { box-sizing: border-box; }

/* Card */
.calc-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 1.5rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.02);
}

/* Head */
.calc-head {
    margin: 0 0 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
}
.calc-head-icon {
    width: 42px; height: 42px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-color, #1a365d), color-mix(in srgb, var(--primary-color, #1a365d) 70%, #000));
    color: #fff; font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
/* Tema h1-h6 varsayılanlarını sıfırla — tema 3rem margin-top yazabilir */
h1.calc-title, h2.calc-title, h3.calc-title,
h4.calc-title, h5.calc-title, h6.calc-title,
.calc-title {
    margin: 0 0 .15rem !important;
    padding: 0 !important;
    font-size: clamp(1.05rem, 3.5vw, 1.25rem) !important;
    font-weight: 700 !important;
    letter-spacing: -.01em !important;
    color: var(--text-color, #111827) !important;
    line-height: 1.25 !important;
    text-transform: none !important;
    border: 0 !important;
    background: transparent !important;
}
.calc-subtitle {
    margin: 0 !important;
    padding: 0 !important;
    font-size: clamp(.78rem, 2.5vw, .85rem) !important;
    color: var(--text-light, #6b7280) !important;
    line-height: 1.4 !important;
    font-weight: 400 !important;
}
/* Calc-head içindeki div wrapper — esnek, taşma yok */
.calc-head > div:not(.calc-head-icon) {
    flex: 1 1 auto;
    min-width: 0;
}

/* Form */
.calc-form {
    display: flex;
    flex-direction: column;
    gap: .9rem;
}
.calc-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .85rem;
}
.calc-field {
    display: flex;
    flex-direction: column;
    min-width: 0; /* grid overflow guard */
}
.calc-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-color, #111827);
    margin-bottom: .35rem;
    line-height: 1.3;
}
.calc-label .calc-required { color: #dc2626; margin-left: 2px; }

/* Inputs — 44px min touch target */
.calc-input, .calc-select {
    font-family: inherit;
    font-size: 16px; /* iOS zoom fix */
    padding: .65rem .85rem;
    min-height: 44px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
}
.calc-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .85rem center;
    padding-right: 2.25rem;
}
.calc-input:focus, .calc-select:focus {
    outline: none;
    border-color: var(--primary-color, #1a365d);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color, #1a365d) 15%, transparent);
}
.calc-input::placeholder { color: #9ca3af; }
.calc-hint {
    font-size: .72rem;
    color: var(--text-light, #6b7280);
    margin-top: .35rem;
    line-height: 1.4;
}

/* Actions */
.calc-actions {
    display: flex;
    gap: .6rem;
    margin-top: .5rem;
    flex-wrap: wrap;
}
.calc-btn {
    padding: .7rem 1.25rem;
    min-height: 44px;
    font-size: .92rem;
    font-weight: 600;
    font-family: inherit;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    transition: transform .15s, filter .15s, box-shadow .15s;
    flex: 1 1 auto;
}
.calc-btn-primary {
    background: var(--primary-color, #1a365d);
    color: #fff;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--primary-color, #1a365d) 30%, transparent);
}
.calc-btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); }
.calc-btn-primary:active { transform: translateY(0); }
.calc-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}
.calc-btn-secondary:hover { background: #e5e7eb; }

/* Result */
.calc-result {
    margin-top: 1.25rem;
    padding: 1.1rem 1.15rem;
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary-color, #1a365d) 6%, #fff), color-mix(in srgb, var(--secondary-color, #c9a84c) 4%, #fff));
    border: 1px solid color-mix(in srgb, var(--primary-color, #1a365d) 20%, transparent);
    border-left: 4px solid var(--primary-color, #1a365d);
    border-radius: 10px;
    animation: calcResultIn .35s ease-out;
    overflow-wrap: anywhere;
    word-break: break-word;
}
@keyframes calcResultIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.calc-result-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .92rem;
    font-weight: 700;
    color: var(--primary-color, #1a365d);
    margin-bottom: .85rem;
    padding-bottom: .55rem;
    border-bottom: 1px solid color-mix(in srgb, var(--primary-color, #1a365d) 15%, transparent);
}
.calc-result-big {
    font-size: clamp(1.4rem, 6vw, 2rem);
    font-weight: 700;
    color: var(--primary-color, #1a365d);
    margin-bottom: 1rem;
    letter-spacing: -.02em;
    line-height: 1.1;
    overflow-wrap: anywhere;
}
.calc-result-items {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.calc-result-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: .45rem 0;
    border-bottom: 1px dashed #e5e7eb;
    font-size: .88rem;
    line-height: 1.4;
}
.calc-result-item:last-child { border-bottom: 0; }
.calc-result-item label {
    color: var(--text-light, #6b7280);
    font-weight: 500;
    margin: 0;
    flex: 0 0 auto;
    max-width: 55%;
}
.calc-result-item span {
    color: var(--text-color, #111827);
    font-weight: 600;
    text-align: right;
    word-break: break-word;
    overflow-wrap: anywhere;
    min-width: 0;
}
.calc-result-item.calc-highlight span {
    color: var(--primary-color, #1a365d);
    font-weight: 700;
    font-size: 1.05em;
}

.calc-note {
    margin-top: 1rem;
    padding: .7rem .9rem;
    background: #fef9c3;
    border: 1px solid #fde68a;
    border-radius: 8px;
    font-size: .78rem;
    color: #854d0e;
    line-height: 1.5;
}
.calc-note i { margin-right: .35rem; }

.calc-error {
    background: #fee2e2;
    border-left-color: #dc2626;
    color: #991b1b;
}
.calc-error .calc-result-head { color: #991b1b; }

.calc-missing {
    max-width: 560px;
    margin: 1rem auto;
    padding: .9rem 1.15rem;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 8px;
    color: #854d0e;
    font-size: .85rem;
}
.calc-missing i { margin-right: .4rem; }
.calc-missing code {
    background: rgba(0,0,0,.05);
    padding: 1px 6px;
    border-radius: 3px;
}

/* ═══════ Responsive breakpoints ═══════ */

/* Tablet & desktop: more breathing room */
@media (min-width: 640px) {
    .calc-container { padding: 0 1.25rem; margin: 2rem auto; }
    .calc-card { padding: 1.75rem; }
    .calc-head-icon { width: 44px; height: 44px; font-size: 1.3rem; }
    .calc-btn { flex: 0 1 auto; padding: .7rem 1.5rem; }
    .calc-actions { justify-content: flex-start; }
}

/* Mobile portrait: single column + tighter spacing */
@media (max-width: 639px) {
    .calc-row { grid-template-columns: 1fr; gap: .75rem; }
    .calc-card { padding: 1.1rem 1rem; border-radius: 12px; }
    .calc-head { gap: .65rem; margin-bottom: 1rem; padding-bottom: .85rem; }
    .calc-head-icon { width: 38px; height: 38px; font-size: 1.1rem; border-radius: 9px; }
    .calc-btn { width: 100%; flex: 1 1 100%; }
    .calc-result { padding: 1rem .95rem; margin-top: 1rem; }
    .calc-result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: .15rem;
        padding: .55rem 0;
    }
    .calc-result-item label { max-width: 100%; font-size: .78rem; }
    .calc-result-item span { text-align: left; width: 100%; font-size: .95rem; }
}

/* Prevent input zoom on iOS (font-size >= 16px already set) */
@supports (-webkit-touch-callout: none) {
    .calc-input, .calc-select { font-size: 16px; }
}

/* Dark mode readiness (optional — respects user pref) */
@media (prefers-color-scheme: dark) {
    .calc-card:where([data-theme="auto"]) {
        background: #1f2937; border-color: #374151; color: #f3f4f6;
    }
}
