/* ==========================================================================
   Alpha Search page (new design)
   Reuses tokens defined in menu.css (--color-blue, --color-gold, --color-offwhite)
   ========================================================================== */

/* Note: CSS variables and content pane background defined in base.css */

body.alpha-search-page-layout td[id$='ContentPane'] {
    background-color: var(--color-offwhite, #F2F0EF) !important;
    background-image: none !important;
}

.alpha-search-page,
.alpha-search-page *,
.alpha-search-page input,
.alpha-search-page select,
.alpha-search-page textarea,
.alpha-search-page button,
.alpha-search-page table,
.alpha-search-page th,
.alpha-search-page td {
    box-sizing: border-box;
    font-family: var(--font-main) !important;
}

.alpha-search-page {
    background: var(--color-offwhite, #F2F0EF);
}

body.alpha-search-page-layout .redesigned-header {
    padding-bottom: 55px;
}

.alpha-search-shell {
    width: 100%;
    max-width: 1080px;
    margin: 30px auto 60px;
    direction: rtl;
}

/* ---------- page header (title + scope pill) ---------- */
.alpha-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.alpha-search-title-block .ar {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--color-blue, #0D4261);
    line-height: 1.3;
}

.alpha-search-title-block .sub {
    display: block;
    margin-top: 4px;
    color: rgba(13, 66, 97, 0.65);
    font-size: 14px;
    font-weight: 400;
}


.alpha-search-scope {
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-width: 220px;
    direction: rtl;
}

.alpha-search-scope-label {
    display: flex;
    align-items: center;
    color: var(--color-blue, #0D4261);
    font-size: 14px;
    font-weight: 600;
    line-height: 18px;
    text-align: right;
    direction: rtl;
}

.alpha-search-scope-select-wrap {
    position: relative;
    width: 100%;
    height: 50px;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16) !important;
    overflow: hidden;
}

.alpha-search-page .alpha-search-scope select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 50px !important;
    border: none !important;
    border-radius: 12px !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #777 !important;
    margin: 0;
    font-size: 15px !important;
    font-weight: 500 !important;
    padding: 0 12px 0 40px !important;
    cursor: pointer !important;
    direction: rtl !important;
    text-align: right !important;
    text-align-last: auto !important;
    -webkit-appearance: none;
    appearance: none;
    transition: box-shadow 0.15s ease, background-color 0.15s ease;
}

.alpha-search-page .alpha-search-scope select:hover {
    background-color: transparent !important;
}

.alpha-search-scope-select-arrow {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 10px;
    color: rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.alpha-search-scope-select-arrow svg {
    width: 16px;
    height: 10px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.alpha-search-scope select option {
    color: var(--color-blue, #0D4261);
    background: #ffffff;
    font-weight: 500;
}

/* hidden postback trigger — visually removed but still focusable/clickable for ASP.NET */
.alpha-search-hidden-postback {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    border: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    background: transparent;
    white-space: nowrap;
}

/* ---------- shared panel ---------- */
.alpha-search-panel {
    background: #ffffff;
    border: 1px solid rgba(13, 66, 97, 0.10);
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(13, 66, 97, 0.06), 0 1px 2px rgba(13, 66, 97, 0.04);
    overflow: hidden;
}

.alpha-search-panel-head {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(13, 66, 97, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.alpha-search-panel-head h3 {
    margin: 0;
    font-size: 21px;
    font-weight: 700;
    color: var(--color-blue, #0D4261);
    display: flex;
    align-items: center;
    gap: 10px;
}

.alpha-tree-title-icon {
    width: 40px;
    height: 30px;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-blue, #0D4261);
}

.alpha-tree-title-icon svg {
    width: 40px;
    height: 30px;
    display: block;
}

.alpha-search-panel-head h3::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-gold, #A29475);
}

/* Hide the decorative dot in the subjects (tree) panel title */
.alpha-search-tree-panel .alpha-search-panel-head h3::before {
    display: none;
}

.alpha-search-panel-head .meta {
    color: rgba(13, 66, 97, 0.55);
    font-size: 12.5px;
}

/* ---------- alphabet bar ---------- */
.alpha-search-alphabet {
    margin-bottom: 0;
    padding: 20px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.alpha-search-alphabet-label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(13, 66, 97, 0.65);
    padding-left: 14px;
    border-left: 1px solid rgba(13, 66, 97, 0.12);
    flex: 0 0 auto;
}

.alpha-search-alphabet .alphabet-list {
    width: 100%;
    overflow: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(13, 66, 97, 0.2) transparent;
}

.alpha-search-alphabet .alphabet-list::-webkit-scrollbar {
    height: 6px;
}

.alpha-search-alphabet .alphabet-list::-webkit-scrollbar-track {
    background: transparent;
}

.alpha-search-alphabet .alphabet-list::-webkit-scrollbar-thumb {
    background: rgba(13, 66, 97, 0.2);
    border-radius: 3px;
}

.alpha-search-alphabet .alphabet-list tbody {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
}

.alpha-search-alphabet .alphabet-list tr {
    display: contents;
}

.alpha-search-alphabet .alphabet-list td {
    border: none !important;
    background: transparent !important;
    display: inline-flex;
    padding: 0 !important;
}

.alpha-search-alphabet .alpha-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 27px;
    min-width: 27px;
    height: 27px;
    padding: 0;
    border-radius: 3px;
    background: #F7F7F7;
    color: var(--color-blue, #0D4261) !important;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none !important;
    border: 1px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
    cursor: pointer;
}

.alpha-search-alphabet .alpha-btn:hover,
.alpha-search-alphabet .alpha-btn:focus {
    background: rgba(162, 148, 117, 0.18);
    color: var(--color-gold, #A29475) !important;
}

.alpha-search-alphabet .alpha-btn.active,
.alpha-search-alphabet .alpha-btn:active {
    background: var(--color-blue, #0D4261);
    color: #ffffff !important;
    border-color: var(--color-blue, #0D4261);
}

/* ---------- main grid ---------- */
.alpha-search-main {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 40px;
    align-items: stretch;
}

.alpha-search-results-column {
    display: flex;
    flex-direction: column;
    gap: 40px;
    min-width: 0;
    height: 100%;
    max-height: 600px;
}

/* ---------- tree panel ---------- */
.alpha-search-tree-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 420px;
    max-height: 600px;
    height: 100%;
}

.alpha-search-tree-panel .alpha-search-panel-head {
    position: relative;
    margin: 25px 30px 0 0;
    padding: 0 0 25px;
    border-bottom: none;
}

.alpha-search-tree-panel .alpha-search-panel-head::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: calc(100% - 24px);
    height: 2px;
    background: rgba(13, 66, 97, 0.12);
}

/* Loading overlay base styles in base.css; page-specific border-radius below */
.alpha-search-tree-loading {
    border-radius: 14px;
}

.alpha-search-tree-panel.is-loading .alpha-search-tree-loading {
    display: flex;
}

.alpha-search-tree-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left:25px;
}

.alpha-search-tree-refresh {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(13, 66, 97, 0.12);
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.2s ease;
}

.alpha-search-tree-refresh:hover {
    border-color: var(--color-gold, #A29475);
    background: rgba(162, 148, 117, 0.10);
}

.alpha-search-tree-refresh:hover img,
.alpha-search-tree-refresh:hover input[type="image"] {
    transform: rotate(45deg);
}

.alpha-search-tree-refresh img,
.alpha-search-tree-refresh input[type="image"] {
    width: 18px !important;
    height: 18px !important;
    border: 0 !important;
    transition: transform 0.3s ease;
}

.alpha-search-tree {
    padding: 8px 8px 16px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    direction: rtl;
}

.alpha-search-tree::-webkit-scrollbar { width: 8px; }
.alpha-search-tree::-webkit-scrollbar-thumb {
    background: rgba(13, 66, 97, 0.15);
    border-radius: 4px;
}

/* ---- Custom subject tree (matches "Alpha Search (slim)" reference) ---- */
.alpha-tree,
.alpha-tree-children,
.alpha-tree li,
.alpha-tree-children li,
.alpha-tree-node {
    list-style: none !important;
    list-style-type: none !important;
    list-style-image: none !important;
    margin: 0;
    padding: 0;
    direction: rtl;
}

.alpha-tree li::marker,
.alpha-tree-children li::marker,
.alpha-tree-node::marker { content: "" !important; }

/* simple right-side indent for nested levels — no dashed guideline */
.alpha-tree-children {
    padding-right: 18px;
}

.alpha-tree-node:not(.is-open) > .alpha-tree-children {
    display: none;
}

.alpha-tree-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    margin: 2px 4px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--color-blue, #0D4261);
    font-size: 14px;
    line-height: 1.55;
    transition: background-color 0.12s ease, color 0.12s ease;
    user-select: none;
}

.alpha-tree-row:hover {
    background: #f7f3e9;
}

.alpha-tree-node.is-selected > .alpha-tree-row {
    background: rgba(13, 66, 97, 0.08);
    color: #143247;
}

/* caret: SVG path draws a down-pointing chevron.
   Collapsed (RTL): rotate 90° → points left ◀
   Open: rotate 0 → points down ▼ */
.alpha-tree-caret {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #97a0a9;
    margin-top: 3px;
    transform: rotate(90deg);
    transition: transform 0.15s ease, color 0.15s ease;
}

.alpha-tree-caret svg {
    width: 11px;
    height: 11px;
    display: block;
}

.alpha-tree-node.leaf > .alpha-tree-row > .alpha-tree-caret {
    visibility: hidden;
}

.alpha-tree-node.is-open > .alpha-tree-row > .alpha-tree-caret {
    transform: rotate(0deg);
    color: var(--color-gold, #A29475);
}

/* node icon — uses currentColor so it picks up the row's color */
.alpha-tree-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #97a0a9;
    margin-top: 4px;
}

.alpha-tree-icon svg {
    width: 14px;
    height: 14px;
    display: block;
}

.alpha-tree-node.is-selected > .alpha-tree-row > .alpha-tree-icon {
    color: var(--color-gold, #A29475);
}

/* label */
.alpha-tree-label {
    flex: 1 1 auto;
    text-align: justify;
    color: inherit;
    font: inherit;
    word-break: break-word;
}

/* ---------- results panel ---------- */
.alpha-search-results-panel {
    min-height: 458px;
    position: relative;
}

/* Loading overlay base styles in base.css; page-specific border-radius below */
.alpha-search-results-loading {
    border-radius: 14px;
}

.alpha-search-results-panel.is-loading .alpha-search-results-loading {
    display: flex;
}

/* Spinner uses shared .alpha-spinner from base.css */
.alpha-search-results-loading .alpha-spinner,
.alpha-search-tree-loading .alpha-spinner {
    animation-name: shared-spin;
}

.alpha-search-results-head {
    padding: 18px 22px 14px;
    border-bottom: 1px solid rgba(13, 66, 97, 0.08);
}

.alpha-search-breadcrumb-section {
    position: relative;
    overflow: hidden;
    padding: 14px 20px;
    background: transparent;
    border-bottom: 1px solid rgba(13, 66, 97, 0.08);
    min-height: 0;
    display: block;
    box-shadow: none !important;
    border-radius: 0;
}

.alpha-search-breadcrumb-loading {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(1.5px);
    -webkit-backdrop-filter: blur(1.5px);
    z-index: 2;
    color: var(--color-blue, #0D4261);
    font-size: 13px;
    font-weight: 600;
}

.alpha-search-breadcrumb-section.is-loading .alpha-search-breadcrumb-loading {
    display: flex;
}

.alpha-search-results-path {
    width: 100%;
    font-size: 13px;
    color: rgba(13, 66, 97, 0.7);
    line-height: 1.7;
}

.alpha-search-breadcrumb-placeholder {
    display: none;
    align-items: center;
    justify-content: flex-start;
    flex-direction: column;
    gap: 8px;
    color: rgba(13, 66, 97, 0.58);
    font-size: 14px;
    font-weight: 600;
    text-align: right;
}

.alpha-search-breadcrumb-placeholder img {
    width: 24px;
    height: 24px;
    opacity: 0.7;
}

.alpha-search-results-path img {
    vertical-align: middle;
    margin: 0 4px;
    opacity: 0.6;
}

.alpha-search-grid-placeholder {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(260px, 100%);
    aspect-ratio: 1 / 1;
    margin: 0;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    color: rgba(13, 66, 97, 0.6);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
}

.alpha-search-grid-placeholder img {
    width: 28px;
    height: 28px;
    opacity: 0.7;
}

.alpha-search-grid-placeholder {
    gap: 16px;
    width: 100%;
    aspect-ratio: auto;
}

.alpha-search-grid-placeholder-icon {
    width: 129px;
    height: 129px;
    border-radius: 50%;
    background: #E4E8EE;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-blue, #0D4261);
}

.alpha-search-grid-placeholder-icon svg {
    width: 80px;
    height: 60px;
    display: block;
}

.alpha-search-grid-placeholder-title {
    margin: 0;
    color: var(--color-blue, #0D4261);
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
}

.alpha-search-grid-placeholder-text {
    margin: 0;
    width: 340px;
    max-width: 780px;
    color: var(--color-blue, #0D4261);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.4;
}

/* Breadcrumb (root → leaf) shown above the results grid */
.alpha-breadcrumb {
    list-style: none !important;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    direction: rtl;
}

.alpha-breadcrumb-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--color-blue, #0D4261);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    max-width: 100%;
}

.alpha-breadcrumb-item::marker { content: "" !important; }

.alpha-breadcrumb-item:not(:last-child)::after {
    content: "‹";
    display: inline-block;
    direction: ltr;
    unicode-bidi: isolate;
    color: rgba(13, 66, 97, 0.4);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.alpha-breadcrumb-item.is-current {
    color: var(--color-blue, #0D4261);
    font-weight: 600;
}

.alpha-search-results-empty {
    padding: 60px 22px;
    text-align: center;
    color: rgba(13, 66, 97, 0.55);
    font-size: 14px;
}

.alpha-search-results-body {
    position: relative;
    padding: 0 18px 20px;
    min-height: 320px;
}

.alpha-search-results-body.is-empty {
    min-height: 458px;
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
    .alpha-search-shell {
        padding: 0 20px;
    }

    .alpha-search-main {
        gap: 24px;
    }
}

@media (max-width: 1023px) {
    .alpha-search-main {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    .alpha-search-results-column {
        display: contents;
        max-height: none;
        height: auto;
    }

    .alpha-search-alphabet {
        order: 1;
    }

    .alpha-search-tree-panel {
        order: 2;
        min-height: auto;
        max-height: 420px;
    }

    .alpha-search-results-panel {
        order: 3;
    }

    .alpha-search-alphabet .alphabet-list {
        overflow: visible;
    }

    .alpha-search-alphabet .alphabet-list tbody {
        flex-wrap: wrap;
        width: 100%;
    }
}

@media (max-width: 720px) {
    .alpha-search-shell {
        padding: 0 20px;
        margin-top: 18px;
    }

    .alpha-search-header {
        flex-direction: column;
        align-items: stretch;
    }

    .alpha-search-scope {
        width: 100%;
        min-width: 0;
    }

    .alpha-search-alphabet {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .alpha-search-alphabet-label {
        border-left: none;
        padding-left: 0;
    }

    .alpha-search-grid-placeholder-title {
        font-size: 24px;
    }

    .alpha-search-grid-placeholder-text {
        font-size: 16px;
    }
}
