/* Per-ayat controls: vertical dots + play button */
.ayat-row-controls-wrap {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.ayat-row-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ayat-menu-trigger,
.ayat-play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.ayat-menu-trigger {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: transparent;
    color: #8b2332;
    font-size: 20px;
    line-height: 1;
}

.ayat-menu-trigger:hover,
.ayat-menu-trigger:focus-visible {
    background: rgba(139, 35, 50, 0.08);
}

.ayat-menu-trigger:active {
    transform: scale(0.94);
}

.ayat-play-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid #8b2332;
    background: #fff;
    color: #8b2332;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(139, 35, 50, 0.15);
}

.ayat-play-btn .fa {
    margin-left: 2px;
}

.ayat-play-btn:hover {
    background: #8b2332;
    color: #fff;
}

.ayat-hidden-actions {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* Options popup modal */
.ayat-options-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.ayat-options-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.ayat-options-modal {
    width: 100%;
    max-width: 340px;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    transform: translateY(16px) scale(0.97);
    transition: transform 0.25s ease;
}

.ayat-options-overlay.is-open .ayat-options-modal {
    transform: translateY(0) scale(1);
}

.ayat-options-header {
    background: linear-gradient(135deg, #8b2332 0%, #6b1a28 100%);
    padding: 14px 16px;
    text-align: center;
}

.ayat-options-header h3 {
    margin: 0;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.ayat-options-body {
    padding: 16px;
}

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

.ayat-options-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 88px;
    padding: 12px 8px;
    border: 1px solid #ececec;
    border-radius: 12px;
    background: #fff;
    color: #8b2332;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
    transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.ayat-options-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 35, 50, 0.12);
    border-color: rgba(139, 35, 50, 0.25);
}

.ayat-options-item:active {
    transform: scale(0.96);
}

.ayat-options-item i {
    font-size: 26px;
    line-height: 1;
}

.ayat-options-item span {
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    line-height: 1.2;
}

.ayat-options-item.is-active {
    background: rgba(139, 35, 50, 0.06);
    border-color: #8b2332;
}

.ayat-options-notes {
    display: none;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #eee;
}

.ayat-options-notes.is-visible {
    display: block;
}

.ayat-options-notes label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #8b2332;
    margin-bottom: 8px;
}

.ayat-options-notes textarea,
#ayat-options-note-input {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    border: 1px solid #ccc !important;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
    background: #ffffff !important;
    color: #1a1a1a !important;
    caret-color: #1a1a1a;
    -webkit-text-fill-color: #1a1a1a !important;
}

.ayat-options-notes textarea::placeholder,
#ayat-options-note-input::placeholder {
    color: #888888 !important;
    opacity: 1;
}

.ayat-options-notes textarea:focus,
#ayat-options-note-input:focus {
    outline: none;
    border-color: #8b2332 !important;
    box-shadow: 0 0 0 2px rgba(139, 35, 50, 0.15);
    background: #ffffff !important;
    color: #1a1a1a !important;
    -webkit-text-fill-color: #1a1a1a !important;
}

.ayat-options-notes-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.ayat-options-notes-actions button {
    flex: 1;
    padding: 9px 12px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.ayat-options-note-save {
    background: #8b2332;
    color: #fff;
}

.ayat-options-note-cancel {
    background: #f0f0f0;
    color: #444;
}

html.dark-mode .ayat-options-modal {
    background: #1e1e2e;
}

html.dark-mode .ayat-options-notes label {
    color: #e8b4bc !important;
}

html.dark-mode .ayat-options-item {
    background: #2a2a3e;
    border-color: rgba(255, 255, 255, 0.1);
    color: #e8b4bc;
}

html.dark-mode .ayat-options-notes textarea,
html.dark-mode #ayat-options-note-input {
    background: #ffffff !important;
    color: #1a1a1a !important;
    border-color: #ccc !important;
    caret-color: #1a1a1a;
    -webkit-text-fill-color: #1a1a1a !important;
}

html.dark-mode .ayat-options-notes textarea:focus,
html.dark-mode #ayat-options-note-input:focus {
    background: #ffffff !important;
    color: #1a1a1a !important;
    -webkit-text-fill-color: #1a1a1a !important;
}

html.dark-mode .ayat-menu-trigger {
    color: #e8b4bc;
}

html.dark-mode .ayat-play-btn {
    background: #2a2a3e;
    border-color: #c8960c;
    color: #c8960c;
}

html.dark-mode .ayat-play-btn:hover {
    background: #c8960c;
    color: #1e1e2e;
}

@media (max-width: 380px) {
    .ayat-options-grid {
        gap: 8px;
    }

    .ayat-options-item {
        min-height: 78px;
        padding: 10px 6px;
    }

    .ayat-options-item i {
        font-size: 22px;
    }

    .ayat-options-item span {
        font-size: 11px;
    }
}
