/**
 * Calculator pages content styles
 *
 * טיפוגרפיה לתוכן שיווקי (אזורי ACF) ולתוכן המסביר בעמודי המחשבונים.
 * האתר נשען על Tailwind CDN שמאפס שוליים לכותרות ופסקאות (preflight),
 * ולכן תוכן WYSIWYG מוזרק זקוק לעיצוב משלו.
 */

.calcala-ad-slot,
.calcala-calculator-content {
    text-align: right;
}

.calcala-ad-slot > :first-child,
.calcala-calculator-content > :first-child {
    margin-top: 0;
}

.calcala-ad-slot > :last-child,
.calcala-calculator-content > :last-child {
    margin-bottom: 0;
}

.calcala-ad-slot h2,
.calcala-calculator-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 1.25rem 0 0.5rem;
    line-height: 1.3;
}

.calcala-ad-slot h3,
.calcala-calculator-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin: 1rem 0 0.375rem;
    line-height: 1.3;
}

.calcala-ad-slot h4,
.calcala-calculator-content h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0.875rem 0 0.375rem;
}

.calcala-ad-slot p,
.calcala-calculator-content p {
    margin: 0.5rem 0;
    line-height: 1.75;
    color: #374151;
}

.calcala-ad-slot a,
.calcala-calculator-content a {
    color: var(--primary-color, #047857);
    text-decoration: underline;
}

.calcala-ad-slot a:hover,
.calcala-calculator-content a:hover {
    color: var(--primary-color-dark, #047857);
}

.calcala-ad-slot ul,
.calcala-ad-slot ol,
.calcala-calculator-content ul,
.calcala-calculator-content ol {
    margin: 0.5rem 0;
    padding-inline-start: 1.5rem;
    color: #374151;
}

.calcala-ad-slot ul,
.calcala-calculator-content ul {
    list-style: disc;
}

.calcala-ad-slot ol,
.calcala-calculator-content ol {
    list-style: decimal;
}

.calcala-ad-slot li,
.calcala-calculator-content li {
    margin: 0.25rem 0;
    line-height: 1.75;
}

.calcala-ad-slot img,
.calcala-calculator-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

/* באנר בתוך סלוט שיווקי — ממורכז */
.calcala-ad-slot img {
    display: block;
    margin-inline: auto;
}

.calcala-ad-slot blockquote,
.calcala-calculator-content blockquote {
    border-inline-start: 4px solid var(--primary-color, #047857);
    background: #f9fafb;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin: 0.75rem 0;
    color: #4b5563;
}

.calcala-ad-slot table,
.calcala-calculator-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
    font-size: 0.925rem;
}

.calcala-ad-slot th,
.calcala-ad-slot td,
.calcala-calculator-content th,
.calcala-calculator-content td {
    border: 1px solid #e5e7eb;
    padding: 0.5rem 0.75rem;
    text-align: right;
}

.calcala-ad-slot th,
.calcala-calculator-content th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
}

/* כפתור ראשי מוכן לשימוש בתוכן שיווקי: <a class="calcala-btn"> */
.calcala-ad-slot .calcala-btn {
    display: inline-block;
    background: var(--primary-color, #047857);
    color: #ffffff;
    font-weight: 600;
    padding: 0.625rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    margin-top: 0.75rem;
    transition: background 0.2s ease;
}

.calcala-ad-slot .calcala-btn:hover {
    background: var(--primary-color-dark, #047857);
    color: #ffffff;
}

/*
 * Select מותאם ל-RTL: החץ המקורי מוסתר ונקודת צ'ברון אפורה
 * מוצגת בצד שמאל — כמקובל בממשקים בעברית.
 */
select.calcala-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%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: left 0.7rem center;
    padding-left: 2.2rem !important;
}

/*
 * Tooltip עזרה לשדות המחשבונים: אייקון סימן שאלה שמציג הסבר
 * בריחוף או בפוקוס מקלדת (נגישות).
 */
.calcala-help {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.calcala-help-btn {
    display: inline-flex;
    align-items: center;
    color: #6b7280;
    background: none;
    border: 0;
    padding: 0;
    cursor: help;
    line-height: 1;
}

.calcala-help-btn .material-symbols-outlined {
    font-size: 1rem;
}

.calcala-help-btn:hover,
.calcala-help-btn:focus-visible {
    color: var(--primary-color, #047857);
    outline: none;
}

.calcala-help-tip {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 50;
    width: 16rem;
    max-width: 70vw;
    padding: 0.5rem 0.75rem;
    background: #1f2937;
    color: #f9fafb;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.6;
    text-align: right;
    border-radius: 0.5rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    display: none;
}

@keyframes calcala-tip-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

.calcala-help:hover .calcala-help-tip,
.calcala-help:focus-within .calcala-help-tip {
    display: block;
    animation: calcala-tip-in 0.15s ease;
}

/* במובייל הסבר פתוח מוצמד לתחתית המסך - קריא ולעולם לא גולש */
@media (max-width: 639px) {
    .calcala-help:hover .calcala-help-tip,
    .calcala-help:focus-within .calcala-help-tip {
        position: fixed;
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        top: auto;
        width: auto;
        max-width: none;
        z-index: 60;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
    }
}

/*
 * כפתורי פעולה (הדפסה / שיתוף) בכל המחשבונים.
 */
.calcala-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.6rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.calcala-action-btn:hover {
    background: #f0fdf4;
    border-color: var(--primary-color, #047857);
    color: var(--primary-color, #047857);
}

/*
 * מודאל שיתוף.
 */
.calcala-share-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 24, 39, 0.55);
    padding: 1rem;
}

.calcala-share-modal__box {
    width: 100%;
    max-width: 32rem;
    background: #ffffff;
    border-radius: 0.9rem;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.calcala-share-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}

.calcala-share-modal__close {
    background: none;
    border: 0;
    font-size: 1.5rem;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
}

.calcala-share-modal__msg {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
}

.calcala-share-modal__row {
    display: flex;
    gap: 0.5rem;
}

.calcala-share-modal__row input {
    flex: 1;
    direction: ltr;
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background: #f9fafb;
}

.calcala-share-modal__copy {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
    background: var(--primary-color, #047857);
    border: 0;
    border-radius: 0.5rem;
    cursor: pointer;
    white-space: nowrap;
}

/*
 * מסמך הדפסה: מוצג רק בהדפסה, ומסתיר את שאר העמוד.
 */
#calcala-print-root {
    display: none;
}

@media print {
    body > *:not(#calcala-print-root) {
        display: none !important;
    }

    #calcala-print-root {
        display: block !important;
        font-family: 'Noto Sans Hebrew', Arial, sans-serif;
        color: #111827;
        font-size: 12px;
        line-height: 1.6;
    }

    #calcala-print-root .calcala-print-head {
        border-bottom: 2px solid #047857;
        padding-bottom: 0.6rem;
        margin-bottom: 1rem;
    }

    #calcala-print-root .calcala-print-site {
        font-size: 0.8rem;
        color: #047857;
        font-weight: 700;
    }

    #calcala-print-root h1 {
        font-size: 1.5rem;
        font-weight: 900;
        margin: 0.2rem 0;
    }

    #calcala-print-root .calcala-print-date {
        font-size: 0.75rem;
        color: #6b7280;
    }

    #calcala-print-root h2 {
        font-size: 1.05rem;
        font-weight: 700;
        margin: 1rem 0 0.4rem;
    }

    #calcala-print-root .calcala-print-table {
        width: 100%;
        border-collapse: collapse;
    }

    #calcala-print-root .calcala-print-table td {
        border-bottom: 1px solid #e5e7eb;
        padding: 0.35rem 0.5rem;
        vertical-align: top;
    }

    #calcala-print-root .calcala-print-table td:first-child {
        color: #4b5563;
        width: 40%;
    }

    #calcala-print-root .calcala-print-table td:last-child {
        font-weight: 600;
    }

    #calcala-print-root .calcala-print-results table {
        width: 100%;
        border-collapse: collapse;
        margin: 0.5rem 0 1rem;
    }

    #calcala-print-root .calcala-print-results th,
    #calcala-print-root .calcala-print-results td {
        border-bottom: 1px solid #e5e7eb;
        padding: 0.35rem 0.5rem;
        text-align: right;
    }

    #calcala-print-root .calcala-print-results p {
        margin: 0.2rem 0;
    }

    #calcala-print-root .calcala-print-foot {
        margin-top: 1.2rem;
        padding-top: 0.5rem;
        border-top: 1px solid #e5e7eb;
        font-size: 0.7rem;
        color: #9ca3af;
        text-align: center;
    }
}

/*
 * רספונסיביות בטפסים: שדות מספריים ופריטי גריד לא יכפו רוחב
 * מינימלי אינטרינזי בעמודות צרות במובייל.
 */
form input[type="number"] {
    min-width: 0;
}

form .grid > * {
    min-width: 0;
}

/* ============================================================
   Calcala V2 - מובייל-פירסט למחשבונים
   ============================================================ */

/* שדות מגע: מינימום 44px לכל שדה קלט במחשבונים */
.calcala-calculator input[type="number"],
.calcala-calculator input[type="text"],
.calcala-calculator input[type="email"],
.calcala-calculator input[type="date"],
.calcala-calculator select,
.calcala-calculator textarea {
    min-height: 2.75rem;
    font-size: max(16px, 1em); /* מונע זום-אוטומטי של iOS בפוקוס */
}

/* טבלאות לוח זמנים: עוברות גלילה אופקית חלקה במובייל */
.calcala-calculator .table-scroll {
    -webkit-overflow-scrolling: touch;
}

/* גרפים: גובה קבוע אבל קטן יותר במובייל כדי לחסוך גלילה */
@media (max-width: 767px) {
    .calcala-calculator .h-72 {
        height: 14rem !important;
    }
}

/* כפתורי פעולה (הדפסה/שיתוף) בגודל מגע תקין */
.calcala-calculator .calcala-action-btn {
    min-width: 2.75rem;
    min-height: 2.75rem;
}
