/* ============================================================
   ACE — Legend / Documentation CSS
   Works with:
     - documentation/legend.php
     - collapsible <details>
     - ACE color-coded Arabic / IPA displays
   ============================================================ */

/* General page layout */
.ace-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 25px;
    line-height: 1.7;
    font-size: 16px;
    color: #222;
}

.ace-title {
    font-size: 30px;
    margin-bottom: 15px;
    font-weight: bold;
}

/* Intro text */
.ace-intro {
    margin-bottom: 25px;
    color: #444;
}

/* ============================================================
   Collapsible blocks
   ============================================================ */
details.ace-block {
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0;
    margin-bottom: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
}

details.ace-block[open] {
    background: #fdfdfd;
}

.ace-summary {
    cursor: pointer;
    padding: 15px 20px;
    background: #eee;
    font-weight: bold;
    font-size: 17px;
    border-bottom: 1px solid #ddd;
}

.ace-summary:hover {
    background: #e3e3e3;
}

.ace-content {
    padding: 18px 22px;
}

/* ============================================================
   Color squares / samples
   ============================================================ */
.legend-color {
    display: inline-block;
    width: 22px;
    height: 12px;
    border-radius: 4px;
    margin-right: 10px;
    vertical-align: middle;
}

.prefix {
    background: #e67e22;  /* ORANGE */
}

.stem {
    background: #22d3ee;  /* TEAL */
}

.suffix {
    background: #84cc16;  /* GREEN */
}

/* Tajweed color blocks */
.ace-color-box {
    width: 100px;
    height: 14px;
    border-radius: 3px;
    margin: 6px 0 12px 0;
}

/* ============================================================
   Root radical colors
   ============================================================ */
.legend-rad {
    padding: 2px 5px;
    font-weight: bold;
    font-size: 18px;
    border-radius: 4px;
}

.legend-rad.r0 { color: #ff0000; }  /* RED */
.legend-rad.r1 { color: #0099ff; }  /* BLUE */
.legend-rad.r2 { color: #00aa00; }  /* GREEN */

/* ============================================================
   List styling
   ============================================================ */
.legend-ul {
    list-style: none;
    padding: 0 0 0 5px;
}

.legend-ul li {
    margin-bottom: 6px;
    padding-left: 5px;
}

.legend-ul.columns-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(200px, 1fr));
}

/* ============================================================
   Tables
   ============================================================ */
.ace-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.ace-table th {
    background: #eee;
    padding: 10px;
    font-weight: bold;
}

.ace-table td {
    border: 1px solid #ddd;
    padding: 10px;
}

/* ============================================================
   Preformatted examples
   ============================================================ */
.ace-pre {
    background: #f6f6f6;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: "Courier New", monospace;
    font-size: 15px;
    overflow-x: auto;
    margin-top: 10px;
    margin-bottom: 15px;
}

/* ============================================================
   Arabic support
   ============================================================ */
[lang="ar"], .ar {
    font-family: "Amiri", serif;
    font-size: 22px;
    direction: rtl;
}

/* ============================================================
   Small screen improvements
   ============================================================ */
@media screen and (max-width: 700px) {
    .legend-ul.columns-2 {
        grid-template-columns: 1fr;
    }

    .ace-table th, .ace-table td {
        padding: 8px;
        font-size: 14px;
    }

    .ace-pre {
        font-size: 14px;
    }
}
