/*
 * ============================================================
 * ACE — MULTIPLE TOKEN PATTERN MATCHER
 * DISPLAY STYLES
 * ============================================================
 */


/* ============================================================
 * PAGE
 * ============================================================ */

body {
    font-family: Arial, sans-serif;
    margin: 24px;
    line-height: 1.5;
    color: #222;
    background: #fff;
}

.ace-page {
    max-width: 1600px;
    margin: 0 auto;
}


/* ============================================================
 * SUMMARY
 * ============================================================ */

.ace-summary {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;

    margin: 20px 0 28px;
    padding: 14px 18px;

    background: #f6f6f6;
    border: 1px solid #ddd;
}

.ace-summary > div {
    white-space: nowrap;
}


/* ============================================================
 * TABLE WRAPPER
 * ============================================================ */

.ace-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}


/* ============================================================
 * RESULT TABLE
 * ============================================================ */

.ace-table {
    width: 100%;
    min-width: 1300px;

    border-collapse: collapse;
}

.ace-table th,
.ace-table td {
    padding: 8px 10px;

    border: 1px solid #ccc;

    vertical-align: middle;
    white-space: nowrap;
}

.ace-table th {
    background: #efefef;

    text-align: left;
    font-weight: 700;
}

.ace-table tbody tr:nth-child(even) {
    background: #fafafa;
}


/* ============================================================
 * TOKEN
 * ============================================================ */

.ace-token {
    font-size: 1.25rem;
    font-weight: 700;
    text-align: right;
}


/* ============================================================
 * RESULT STATES
 * ============================================================ */

.ace-matched {
    background: #f4fff4;
}

.ace-not-matched {
    background: #fff1f1 !important;
}

.ace-error {
    background: #fff8e5 !important;
}


/* ============================================================
 * ALIGNMENT
 * ============================================================ */

.ace-center {
    text-align: center;
}


/* ============================================================
 * CODE VALUES
 * ============================================================ */

code {
    font-size: 0.95em;
}


/* ============================================================
 * MATCHER ERRORS
 * ============================================================ */

.ace-errors {
    margin-top: 32px;
}

.ace-error-token {
    font-size: 1.2rem;
    font-weight: 700;
}


/* ============================================================
 * RESPONSIVE DISPLAY
 * ============================================================ */

@media (max-width: 768px) {

    body {
        margin: 12px;
    }

    .ace-summary {
        gap: 12px;
        padding: 12px;
    }

    .ace-summary > div {
        flex: 1 1 45%;
    }

    .ace-token {
        font-size: 1.15rem;
    }

}
/* =========================================================
   ND STRUCTURAL COMPONENTS
   ========================================================= */

.ace-nd-part {
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

/* Append = soft violet */
.ace-nd-append,
.ace-nd-append-head {
    background: #f2e8ff;
}

/* Exact/base = soft green */
.ace-nd-exact,
.ace-nd-exact-head {
    background: #e6f7ec;
}

/* Prepend = soft blue */
.ace-nd-prepend,
.ace-nd-prepend-head {
    background: #e7f1ff;
}


/* =========================================================
   TRANSLATIONS
   ========================================================= */

.ace-translation {
    font-weight: 600;
    text-align: left;
}

/* Translation of prepend */
.ace-prepend-translation,
.ace-trans-prepend-head {
    background: #edf5ff;
}

/* Main lexical translation */
.ace-main-translation,
.ace-trans-exact-head {
    background: #fff4cc;
}

/* Translation of append */
.ace-append-translation,
.ace-trans-append-head {
    background: #f5edff;
}


/* Main lexical meaning gets slightly more emphasis */
.ace-main-translation {
    font-weight: 700;
}
    .ace-main-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 0 0 18px 0;
        padding: 12px;
        border: 1px solid #d7dce2;
        border-radius: 8px;
        background: #f7f8fa;
    }

    .ace-main-nav a {
        display: inline-block;
        padding: 7px 10px;
        border: 1px solid #c8ced6;
        border-radius: 6px;
        text-decoration: none;
        background: #ffffff;
        color: #1f2937;
        white-space: nowrap;
    }

    .ace-token-panel {
        margin: 0 0 18px 0;
        padding: 16px;
        border: 1px solid #cfd6df;
        border-radius: 8px;
        background: #ffffff;
    }

    .ace-token-panel h2 {
        margin-top: 0;
    }

    .ace-input-source {
        display: flex;
        flex-wrap: wrap;
        gap: 18px;
        margin-bottom: 12px;
    }

    .ace-keyboard-row {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }

    .ace-keyboard-input {
        min-width: 320px;
        max-width: 100%;
        padding: 9px 10px;
        font-size: 1.35rem;
        text-align: right;
    }

    .ace-analyze-button {
        padding: 9px 16px;
        font-weight: 700;
        cursor: pointer;
    }

    .ace-source-note {
        margin: 10px 0 0 0;
        color: #4b5563;
    }

    .ace-active-token {
        font-size: 1.4rem;
        font-weight: 700;
    }
/* ============================================================
   ACE EXTENDED ARABIC KEYBOARD
   Add this block to ../../css/ace_pattern_no.css
   ============================================================ */

.ace-arabic-keyboard {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid #c9c9c9;
    border-radius: 8px;
}

.ace-arabic-keyboard[hidden] {
    display: none !important;
}

.ace-keyboard-utility-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.ace-keyboard-menu {
    margin-top: 8px;
    border-top: 1px solid #ddd;
    padding-top: 8px;
}

.ace-keyboard-menu > summary {
    cursor: pointer;
    font-weight: 700;
    padding: 5px 0;
}

.ace-key-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
    gap: 6px;
    margin-top: 8px;
}

.ace-key {
    min-height: 42px;
    padding: 7px 10px;
    border: 1px solid #aaa;
    border-radius: 6px;
    background: #fff;
    color: #111;
    cursor: pointer;
}

.ace-arabic-key {
    font-size: 1.45rem;
    line-height: 1.2;
    font-family: "Noto Naskh Arabic", "Amiri", serif;
}

.ace-key:hover,
.ace-key:focus-visible {
    background: #f1f1f1;
}

.ace-key-action {
    font-size: 0.95rem;
}

.ace-keyboard-input:disabled {
    opacity: 0.55;
}

@media (max-width: 600px) {
    .ace-key-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .ace-key {
        min-height: 40px;
        padding: 6px;
    }
}
