/**
 * Prediction-engine output styles.
 * Scoped under #tch-predictions-content so it can't leak into other
 * plugin output. Designed to read like a natural continuation of the
 * existing panchangam + chart styles.
 *
 * @package TamilcubeHoroscope
 * @version 1.6.0
 */

#tch-predictions-results {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Noto Sans Tamil", sans-serif;
    color: #1c1c1e;
    line-height: 1.6;
}

/* ---------- Collapsible wrapper (<details>) ---------- */
.tch-section-predictions {
    margin: 30px auto;
    max-width: 1200px;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    background: #fffbeb;
    overflow: hidden;
}

.tch-section-predictions > .tch-predictions-summary {
    cursor: pointer;
    list-style: none;
    padding: 14px 20px;
    font-size: 18px;
    font-weight: 600;
    color: #78350f;
    background: #fef3c7;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Hide the default <summary> disclosure triangle in WebKit/Blink */
.tch-section-predictions > .tch-predictions-summary::-webkit-details-marker {
    display: none;
}
.tch-section-predictions > .tch-predictions-summary::marker {
    display: none;
    content: '';
}

/* Custom chevron that rotates when open */
.tch-section-predictions > .tch-predictions-summary::before {
    content: '▶';
    display: inline-block;
    font-size: 12px;
    color: #92400e;
    transition: transform 0.2s ease;
}
.tch-section-predictions[open] > .tch-predictions-summary::before {
    transform: rotate(90deg);
}

.tch-section-predictions > .tch-predictions-summary:hover {
    background: #fde68a;
}

/* When the details panel is open, the inner result container gets its
   normal max-width/margin from the rule above. */
.tch-section-predictions[open] #tch-predictions-results {
    margin: 0;
    padding: 0 20px 20px;
}

#tch-predictions-content h3 {
    margin: 28px 0 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #d97706;
    color: #92400e;
    font-size: 20px;
}

#tch-predictions-content p {
    margin: 8px 0;
}

#tch-predictions-content b {
    color: #1c1c1e;
}

/* ---------- Graha report table ---------- */
#tch-predictions-content table.tch-pred-graha {
    width: 100%;
    margin: 0 0 24px;
    border-collapse: collapse;
    font-size: 14px;
}

#tch-predictions-content table.tch-pred-graha th,
#tch-predictions-content table.tch-pred-graha td {
    border: 1px solid #e5e7eb;
    padding: 8px 10px;
    vertical-align: top;
}

#tch-predictions-content table.tch-pred-graha thead th {
    background: #fef3c7;
    color: #78350f;
    font-weight: 600;
    text-align: left;
}

#tch-predictions-content table.tch-pred-graha tbody tr:nth-child(even) {
    background: #fffbeb;
}

/* ---------- House report table ---------- */
#tch-predictions-content table.tch-pred-houses {
    width: 100%;
    margin: 0 0 24px;
    border-collapse: collapse;
    font-size: 14px;
}

#tch-predictions-content table.tch-pred-houses th,
#tch-predictions-content table.tch-pred-houses td {
    border: 1px solid #e5e7eb;
    padding: 10px;
    vertical-align: top;
}

#tch-predictions-content table.tch-pred-houses thead th {
    background: #fef3c7;
    color: #78350f;
    font-weight: 600;
    text-align: left;
}

/* The interpretation sub-rows colspan="4" — give them visual separation. */
#tch-predictions-content table.tch-pred-houses td[colspan="4"] {
    background: #fafafa;
    color: #374151;
    font-size: 13px;
}

/* ---------- Ashtakavarga ---------- */
#tch-predictions-content table.tch-ashtakavarga {
    width: 100%;
    margin: 0 0 24px;
    border-collapse: collapse;
    font-size: 14px;
    text-align: center;
}

#tch-predictions-content table.tch-ashtakavarga th,
#tch-predictions-content table.tch-ashtakavarga td {
    border: 1px solid #e5e7eb;
    padding: 6px 8px;
}

#tch-predictions-content table.tch-ashtakavarga thead th,
#tch-predictions-content table.tch-ashtakavarga tr th:first-child {
    background: #fef3c7;
    color: #78350f;
    font-weight: 600;
}

#tch-predictions-content table.tch-ashtakavarga td:last-child {
    background: #fef3c7;
    font-weight: 600;
}

/* ---------- Dasa table ---------- */
#tch-predictions-content table.tch-dasa {
    width: 100%;
    max-width: 600px;
    margin: 0 0 24px;
    border-collapse: collapse;
    font-size: 14px;
}

#tch-predictions-content table.tch-dasa th,
#tch-predictions-content table.tch-dasa td {
    border: 1px solid #e5e7eb;
    padding: 6px 10px;
}

#tch-predictions-content table.tch-dasa thead th {
    background: #fef3c7;
    color: #78350f;
    font-weight: 600;
    text-align: left;
}

#tch-predictions-content table.tch-dasa tbody tr td:first-child b,
#tch-predictions-content table.tch-dasa tbody tr td:nth-child(2) b {
    color: #92400e;
}

/* Remaining-dasa banner */
#tch-predictions-content .tch-pred-remaining-dasa {
    background: #fef3c7;
    border-left: 4px solid #d97706;
    padding: 10px 14px;
    margin: 0 0 20px;
    font-size: 15px;
}

/* Current (running) dasa-bhukti banner */
#tch-predictions-content .tch-pred-current-dasa {
    background: #dcfce7;
    border-left: 4px solid #16a34a;
    padding: 10px 14px;
    margin: 0 0 16px;
    font-size: 15px;
}

/* Print-friendly */
@media print {
    #tch-predictions-content table {
        page-break-inside: auto;
    }
    #tch-predictions-content tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}

/* Mobile */
@media (max-width: 768px) {
    /* Reclaim horizontal space on small screens. */
    #tch-predictions-results,
    .tch-section-predictions[open] #tch-predictions-results {
        padding-left: 12px;
        padding-right: 12px;
    }

    #tch-predictions-content table.tch-pred-graha,
    #tch-predictions-content table.tch-pred-houses {
        font-size: 12px;
    }
    #tch-predictions-content table.tch-pred-graha th,
    #tch-predictions-content table.tch-pred-graha td,
    #tch-predictions-content table.tch-pred-houses th,
    #tch-predictions-content table.tch-pred-houses td {
        padding: 6px;
    }

    /* Wide, mostly-numeric tables: keep columns intact and let the table
       scroll sideways instead of being clipped by the panel. */
    #tch-predictions-content table.tch-pred-graha,
    #tch-predictions-content table.tch-ashtakavarga {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    /* Text-heavy tables: stay full-width and WRAP long Tamil text rather
       than overflowing. overflow-x is a safety net. */
    #tch-predictions-content table.tch-pred-houses,
    #tch-predictions-content table.tch-dasa {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    #tch-predictions-content table.tch-pred-houses th,
    #tch-predictions-content table.tch-pred-houses td,
    #tch-predictions-content table.tch-dasa th,
    #tch-predictions-content table.tch-dasa td {
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}
