.hc-wrap,
.hc-wrap * {
    box-sizing: border-box;
}

.hc-wrap {
    direction: rtl;
    max-width: 1100px;
    margin: 0 auto;
    color: #222;
    font-family: inherit;
}

.hc-wrap h1 {
    font-size: 30px;
    line-height: 1.5;
    margin: 0 0 8px;
}

.hc-wrap h2 {
    font-size: 23px;
    line-height: 1.6;
    margin: 18px 0 12px;
}

.hc-wrap > h1,
.hc-wrap > h2,
.hc-current-month-title {
    text-align: center;
}

.hc-current-month-title {
    font-size: 18px;
    font-weight: 500;
    margin: 8px 0 18px;
}

.hc-current-month-title a {
    color: #4b8425;
    text-decoration: none;
}

.hc-current-month-title a:hover {
    text-decoration: underline;
}

.hc-month-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 18px 0;
}

.hc-month-nav a,
.hc-month-nav .hc-month-nav-item {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    border: 1px solid #386d9f;
    border-radius: 5px;
    padding: 11px 14px;
    background: #fff;
    color: #222;
}

.hc-month-nav a:last-child,
.hc-month-nav .hc-month-nav-item:last-child {
    text-align: left;
}

.hc-month-nav small {
    color: #666;
    margin-bottom: 3px;
}

.hc-month-nav strong {
    color: #386d9f;
}

.hc-settings {
    border: 1px solid #ccc;
    border-radius: 5px;
    background: #f7f7f7;
    margin: 15px 0;
}

.hc-settings summary {
    cursor: pointer;
    font-weight: 700;
    padding: 13px 15px;
}

.hc-settings-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 0 15px 15px;
}

.hc-settings label {
    font-weight: 700;
}

.hc-settings select {
    display: block;
    width: 100%;
    height: 44px;
    margin-top: 6px;
    border: 1px solid #1762ad;
    background: #fff;
    color: #222;
    border-radius: 4px;
    padding: 6px;
}

/* =========================
   TABLEAUX SANS SCROLL HORIZONTAL
   ========================= */

.hc-table-wrap {
    width: 100%;
    overflow-x: visible;
    margin: 15px 0;
}

.hc-table-wrap table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
}

.hc-table-wrap th,
.hc-table-wrap td {
    border: 1px solid #ccc;
    padding: 10px;
    text-align: center;
    color: #222;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    vertical-align: middle;
}

.hc-table-wrap th {
    background: #386d9f;
    color: #fff;
}

.hc-calendar-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.hc-calendar-table th:nth-child(1),
.hc-calendar-table td:nth-child(1) {
    width: 24%;
}

.hc-calendar-table th:nth-child(2),
.hc-calendar-table td:nth-child(2) {
    width: 38%;
}

.hc-calendar-table th:nth-child(3),
.hc-calendar-table td:nth-child(3) {
    width: 38%;
}

.hc-calendar-table tr:nth-child(even) td {
    background: #f7f7f7;
}

.hc-calendar-table tr.is-today td {
    background: #e8f3df;
    font-weight: 700;
    border-color: #4b8425;
}

.hc-scroll-hint {
    display: none !important;
}

.hc-source {
    font-size: 14px;
    color: #666;
    margin: 8px 0 8px;
}

.hc-source a {
    color: #386d9f;
}

.hc-today-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 20px;
    font-size: 14px;
    color: #555;
    direction: rtl;
}

.hc-today-legend-box {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: #4b8425;
    border-radius: 3px;
    flex-shrink: 0;
}

.hc-gregorian-months table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.hc-gregorian-months table td:first-child {
    width: 45%;
}

.hc-gregorian-months table td:last-child {
    width: 55%;
}

.hc-jump {
    margin: 25px 0;
    padding: 18px;
    border: 1px solid #ccc;
    background: #f7f7f7;
    border-radius: 5px;
}

.hc-jump form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
}

.hc-jump select,
.hc-jump input,
.hc-convert-form input,
.hc-convert-form select {
    height: 45px;
    border: 1px solid #1762ad;
    border-radius: 4px;
    background: #fff;
    color: #222;
    padding: 7px;
}

.hc-primary {
    border: 0;
    border-radius: 4px;
    background: #4b8425;
    color: #fff;
    padding: 10px 18px;
    font-weight: 700;
    cursor: pointer;
}

.hc-year-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.hc-year-grid a {
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    text-align: center;
    text-decoration: none;
    color: #386d9f;
    background: #fff;
}

.hc-today-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 18px 0;
}

.hc-info-card {
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 16px;
    background: #f7f7f7;
}

.hc-info-card span {
    display: block;
    color: #666;
    margin-bottom: 5px;
}

.hc-info-card strong {
    font-size: 20px;
}

.hc-event-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.hc-event-grid div {
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 13px;
    background: #fff;
}

.hc-event-grid strong,
.hc-event-grid span {
    display: block;
}

.hc-event-grid span {
    color: #666;
    margin-top: 5px;
}

.hc-daily-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 24px 0;
}

.hc-daily-cards article {
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 15px;
    background: #f7f7f7;
}

.hc-daily-cards h3 {
    margin-top: 0;
    color: #386d9f;
}

.hc-history {
    margin: 25px 0;
}

.hc-history ul {
    padding-right: 22px;
}

.hc-muted {
    color: #777;
}

.hc-note {
    border-right: 4px solid #4b8425;
    background: #f7f7f7;
    padding: 14px 16px;
    line-height: 2;
    margin-top: 25px;
}

.hc-countdown-note {
    font-weight: 700;
}

.hc-convert-tabs {
    display: flex;
    gap: 8px;
    margin: 18px 0;
}

.hc-convert-tabs button {
    border: 1px solid #386d9f;
    background: #fff;
    color: #386d9f;
    border-radius: 4px;
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 700;
}

.hc-convert-tabs button.is-active {
    background: #386d9f;
    color: #fff;
}

.hc-convert-form {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
    padding: 17px;
    border: 1px solid #ccc;
    background: #f7f7f7;
    border-radius: 5px;
}

.hc-convert-form label {
    display: block;
    font-weight: 700;
    margin-bottom: 5px;
}

.hc-convert-form input,
.hc-convert-form select {
    width: 100%;
}

.hc-result {
    margin-top: 20px;
}

.hc-result h2 {
    background: #4b8425;
    color: #fff;
    padding: 10px 14px;
}

@media (max-width: 760px) {

    .hc-wrap h1 {
        font-size: 25px;
    }

    .hc-wrap h2 {
        font-size: 20px;
    }

    .hc-settings-body,
    .hc-today-grid,
    .hc-daily-cards,
    .hc-event-grid,
    .hc-convert-form {
        grid-template-columns: 1fr;
    }

    .hc-year-grid {
        grid-template-columns: 1fr 1fr;
    }

    .hc-jump form {
        grid-template-columns: 1fr;
    }

    .hc-month-nav a,
    .hc-month-nav .hc-month-nav-item {
        padding: 10px;
    }

    .hc-month-nav strong {
        font-size: 14px;
    }

    .hc-table-wrap {
        width: 100%;
        overflow-x: visible;
    }

    .hc-table-wrap table,
    .hc-calendar-table,
    .hc-gregorian-months table {
        width: 100%;
        min-width: 0 !important;
    }

    .hc-calendar-table {
        table-layout: fixed;
    }

    .hc-calendar-table th,
    .hc-calendar-table td {
        padding: 11px 5px;
        font-size: 15px;
        line-height: 1.65;
        white-space: normal !important;
        word-break: normal;
        overflow-wrap: break-word;
    }

    .hc-calendar-table th:nth-child(1),
    .hc-calendar-table td:nth-child(1) {
        width: 24%;
    }

    .hc-calendar-table th:nth-child(2),
    .hc-calendar-table td:nth-child(2) {
        width: 38%;
    }

    .hc-calendar-table th:nth-child(3),
    .hc-calendar-table td:nth-child(3) {
        width: 38%;
    }

    .hc-gregorian-months table {
        table-layout: fixed;
    }

    .hc-gregorian-months td {
        white-space: normal !important;
        overflow-wrap: break-word;
    }

    .hc-scroll-hint {
        display: none !important;
    }
}

@media (max-width: 420px) {

    .hc-calendar-table th,
    .hc-calendar-table td {
        padding: 9px 4px;
        font-size: 14px;
        line-height: 1.6;
    }

    .hc-calendar-table th:nth-child(1),
    .hc-calendar-table td:nth-child(1) {
        width: 23%;
    }

    .hc-calendar-table th:nth-child(2),
    .hc-calendar-table td:nth-child(2) {
        width: 38.5%;
    }

    .hc-calendar-table th:nth-child(3),
    .hc-calendar-table td:nth-child(3) {
        width: 38.5%;
    }
}


/* =========================
   /today/ - historique en accordeons legers
   ========================= */
.hc-today-otd {
    margin: 25px 0;
}

.hc-today-otd .hc-otd-heading {
    margin: 0 0 10px;
    color: #555;
    font-size: 15px;
}

.hc-today-accordion {
    border: 1px solid #d8d8d8;
    border-radius: 5px;
    background: #fff;
    margin: 0 0 10px;
    overflow: hidden;
}

.hc-today-accordion summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    list-style: none;
    padding: 13px 15px;
    font-weight: 700;
    color: #386d9f;
    background: #f7f7f7;
}

.hc-today-accordion summary::-webkit-details-marker {
    display: none;
}

.hc-today-accordion[open] summary {
    border-bottom: 1px solid #e2e2e2;
}

.hc-accordion-chevron {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform .15s ease;
}

.hc-today-accordion[open] .hc-accordion-chevron {
    transform: rotate(135deg);
}

.hc-today-history-list {
    margin: 0;
    padding: 12px 38px 12px 16px;
}

.hc-today-history-list > li {
    margin: 0 0 12px;
    padding: 0 0 12px;
    line-height: 1.9;
}

.hc-today-history-list > li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
}

.hc-today-history-list .hc-otd-item-title {
    display: inline;
}

.hc-today-history-list .hc-otd-description p {
    margin: 5px 0 0;
}

.hc-today-history-list .hc-otd-years,
.hc-today-history-list .hc-otd-range,
.hc-today-history-list .hc-otd-source,
.hc-hadith-source {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 13px;
    line-height: 1.7;
}

.hc-today-history-list .hc-otd-years span + span {
    margin-right: 8px;
}

.hc-today-history-list .hc-otd-source a {
    color: #386d9f;
    text-decoration: none;
}

.hc-today-history-list .hc-otd-source a:hover {
    text-decoration: underline;
}

@media (max-width: 760px) {
    .hc-today-accordion summary {
        padding: 12px 13px;
    }

    .hc-today-history-list {
        padding: 11px 32px 11px 12px;
    }
}

/* SEO content blocks: lightweight and readable, placed after the tools */
.hc-seo-content {
    margin: 34px 0 10px;
    padding-top: 24px;
    border-top: 1px solid #ddd;
    line-height: 1.95;
}

.hc-seo-content h2 {
    margin: 0 0 12px;
    font-size: 23px;
    text-align: right;
}

.hc-seo-content h3 {
    margin: 22px 0 8px;
    font-size: 19px;
    color: #386d9f;
}

.hc-seo-content p {
    margin: 0 0 13px;
}

.hc-seo-content a {
    color: #386d9f;
    text-decoration: underline;
    text-underline-offset: 2px;
}

@media (max-width: 760px) {
    .hc-seo-content {
        margin-top: 28px;
        padding-top: 20px;
    }

    .hc-seo-content h2 {
        font-size: 21px;
    }

    .hc-seo-content h3 {
        font-size: 18px;
    }
}


/* Bilingual menu: active item = green underline only.
   Avoid theme current-menu-item backgrounds/colors. */
.hc-menu-current {
    position: relative;
    background: transparent !important;
}

.hc-menu-current::after {
    content: "";
    position: absolute;
    right: 0;
    left: 0;
    bottom: 0;
    height: 3px;
    background: #4b8425;
    pointer-events: none;
}


/* Language direction: English pages are fully LTR while Arabic stays RTL. */
.hc-wrap[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

.hc-wrap[dir="rtl"] {
    direction: rtl;
}

.hc-wrap[dir="ltr"] .hc-today-legend {
    direction: ltr;
}

.hc-wrap[dir="ltr"] .hc-month-nav a:last-child {
    text-align: right;
}

.hc-wrap[dir="ltr"] .hc-history ul {
    padding-right: 0;
    padding-left: 22px;
}

.hc-wrap[dir="ltr"] .hc-note {
    border-right: 0;
    border-left: 4px solid #4b8425;
}

.hc-wrap[dir="ltr"] .hc-today-history-list .hc-otd-years span + span {
    margin-right: 0;
    margin-left: 8px;
}

.hc-wrap[dir="ltr"] .hc-seo-content h2 {
    text-align: left;
}

@media (max-width: 760px) {
    .hc-wrap[dir="ltr"] .hc-today-history-list {
        padding: 11px 12px 11px 32px;
    }
}

/* English SEO blocks can sit outside .hc-wrap on the home page. */
.hc-seo-content[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

.hc-seo-content[dir="ltr"] h2,
.hc-seo-content[dir="ltr"] h3,
.hc-seo-content[dir="ltr"] p {
    text-align: left;
}
