/*
 * Adhan Display
 * Islamic UI V8 - Tasbih Final Layout
 *
 * Purpose:
 * - Center the complete Tasbih tool
 * - Remove inherited oversized tap-area dimensions
 * - Create a compact centered TAP control
 * - Keep existing Tasbih JavaScript untouched
 */

/* ============================================================
   TASBIH VIEW
   ============================================================ */

.islamic-page .tasbih-view {
    width: 100% !important;
    max-width: 900px !important;
    margin-left: auto !important;
    margin-right: auto !important;

    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;

    text-align: center !important;

    position: relative !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    float: none !important;

    grid-column: 1 / -1 !important;
}

/* Header */

.islamic-page .tasbih-view .islamic-tool-header {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;

    margin-left: auto !important;
    margin-right: auto !important;
}

/* ============================================================
   TASBIH CONTAINER
   ============================================================ */

.islamic-page .tasbih-container {
    width: min(100%, 620px) !important;
    max-width: 620px !important;

    margin: 0 auto !important;

    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;

    text-align: center !important;

    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;
    float: none !important;

    box-sizing: border-box !important;
}

/* ============================================================
   CURRENT COUNT
   ============================================================ */

.islamic-page .tasbih-container .tasbih-counter {
    width: 100% !important;

    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;

    text-align: center !important;

    margin-left: auto !important;
    margin-right: auto !important;

    position: relative !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    float: none !important;
}

/* Current count label */

.islamic-page .tasbih-container .tasbih-counter .ad2-eyebrow {
    display: block !important;
    width: 100% !important;

    text-align: center !important;

    margin-left: auto !important;
    margin-right: auto !important;
}

/* Number */

.islamic-page .tasbih-container [data-tasbih-count] {
    display: block !important;

    width: 100% !important;

    margin-left: auto !important;
    margin-right: auto !important;

    text-align: center !important;

    position: relative !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    float: none !important;

    line-height: 1 !important;
}

/* ============================================================
   TAP CONTROL
   ============================================================ */

/*
 * The old implementation leaves a very tall tap shell.
 * Explicitly remove inherited sizing and make the shell itself
 * the visual interaction surface.
 */

.islamic-page .tasbih-tap-shell {
    width: min(100%, 320px) !important;
    max-width: 320px !important;

    height: 150px !important;
    min-height: 150px !important;
    max-height: 150px !important;

    margin: 32px auto 0 !important;
    padding: 0 !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    box-sizing: border-box !important;

    text-align: center !important;

    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;

    transform: none !important;
    float: none !important;

    overflow: hidden !important;

    cursor: pointer !important;

    border-radius: 28px !important;

    /*
     * Use the existing theme variables where available.
     * The fallback keeps the control visible in both themes.
     */
    background: var(--ad2-color-surface, rgba(255,255,255,.72)) !important;
    border: 1px solid var(--ad2-color-border, rgba(0,0,0,.10)) !important;

    box-shadow:
        0 12px 30px rgba(0,0,0,.08),
        inset 0 1px 0 rgba(255,255,255,.45) !important;

    color: var(--ad2-color-text, #171717) !important;

    font-size: 1rem !important;
    font-weight: 700 !important;
}

/*
 * Remove any pseudo-element decoration that may be responsible
 * for the oversized visual area.
 */

.islamic-page .tasbih-tap-shell::before,
.islamic-page .tasbih-tap-shell::after {
    content: none !important;
    display: none !important;
}

/*
 * If the existing implementation contains a button inside
 * the shell, make that button fill the shell and center its text.
 */

.islamic-page .tasbih-tap-shell button {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;

    margin: 0 !important;
    padding: 0 24px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    box-sizing: border-box !important;

    text-align: center !important;

    position: static !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;

    transform: none !important;
    float: none !important;

    border: 0 !important;
    border-radius: inherit !important;

    background: transparent !important;
    box-shadow: none !important;

    color: inherit !important;

    font-size: 1rem !important;
    font-weight: 700 !important;

    cursor: pointer !important;
}

/*
 * Any direct text/span inside the tap shell must be centered.
 */

.islamic-page .tasbih-tap-shell > span,
.islamic-page .tasbih-tap-shell > strong,
.islamic-page .tasbih-tap-shell > div {
    position: static !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    width: 100% !important;
    height: 100% !important;

    margin: 0 !important;
    padding: 0 !important;

    text-align: center !important;

    transform: none !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
}

/*
 * If the literal TAP text is a direct text node, the shell itself
 * remains the flex container and therefore centers it.
 */

/* ============================================================
   HOVER / ACTIVE / FOCUS
   ============================================================ */

.islamic-page .tasbih-tap-shell:hover {
    transform: translateY(-2px) !important;

    box-shadow:
        0 16px 34px rgba(0,0,0,.11),
        inset 0 1px 0 rgba(255,255,255,.5) !important;
}

.islamic-page .tasbih-tap-shell:active {
    transform: translateY(1px) !important;

    box-shadow:
        0 7px 18px rgba(0,0,0,.08),
        inset 0 1px 0 rgba(255,255,255,.35) !important;
}

.islamic-page .tasbih-tap-shell:focus-visible {
    outline: 3px solid rgba(212,175,55,.45) !important;
    outline-offset: 4px !important;
}

.islamic-page .tasbih-tap-shell button:focus,
.islamic-page .tasbih-tap-shell button:focus-visible {
    outline: none !important;
}

/* ============================================================
   DARK MODE
   ============================================================ */

:root[data-theme="dark"] .islamic-page .tasbih-tap-shell,
[data-theme="dark"] .islamic-page .tasbih-tap-shell {
    background: var(--ad2-color-surface, rgba(255,255,255,.055)) !important;

    border-color:
        var(--ad2-color-border, rgba(255,255,255,.12)) !important;

    color:
        var(--ad2-color-text, #f5f5f5) !important;

    box-shadow:
        0 14px 32px rgba(0,0,0,.24),
        inset 0 1px 0 rgba(255,255,255,.05) !important;
}

/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 767px) {
    .islamic-page .tasbih-view {
        width: 100% !important;
        max-width: 100% !important;
    }

    .islamic-page .tasbih-container {
        width: 100% !important;
        max-width: 100% !important;
    }

    .islamic-page .tasbih-tap-shell {
        width: min(100%, 300px) !important;
        max-width: 300px !important;

        height: 130px !important;
        min-height: 130px !important;
        max-height: 130px !important;

        margin-top: 28px !important;
    }
}

@media (max-width: 480px) {
    .islamic-page .tasbih-tap-shell {
        width: min(100%, 280px) !important;
        max-width: 280px !important;

        height: 120px !important;
        min-height: 120px !important;
        max-height: 120px !important;

        border-radius: 24px !important;
    }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    .islamic-page .tasbih-tap-shell,
    .islamic-page .tasbih-tap-shell:hover,
    .islamic-page .tasbih-tap-shell:active {
        transition: none !important;
        transform: none !important;
    }
}

/* ============================================================
   PRINT
   ============================================================ */

@media print {
    .islamic-page .tasbih-tap-shell {
        box-shadow: none !important;
        transform: none !important;
    }
}
