/**
 * Mikaeel Audio-Text Sync Stylesheet v1.2.0 (Joomla 5 / mikaeel_emerald compatible)
 * Zero-lag 60fps underline transition, Arabic RTL typography, harakat-safe offset, and Dark Mode.
 */

:root {
    --mas-underline-color: #0d9488;
    --mas-underline-thickness: 2.5px;
    --mas-underline-offset: 6px;
    --mas-active-bg: rgba(13, 148, 136, 0.13);
    --mas-hover-bg: rgba(13, 148, 136, 0.06);
}

/* Dark mode support for mikaeel_emerald template */
[data-bs-theme="dark"],
body.dark-mode,
body.theme-dark,
html.dark {
    --mas-underline-color: #2dd4bf;
    --mas-active-bg: rgba(45, 212, 191, 0.17);
    --mas-hover-bg: rgba(45, 212, 191, 0.08);
}

.mas-segment,
.mas-word {
    transition: background-color 0.08s ease;
    border-radius: 4px;
    padding: 1px 2px;
}

.mas-clickable .mas-segment,
.mas-clickable .mas-word {
    cursor: pointer;
}

.mas-clickable .mas-segment:hover,
.mas-clickable .mas-word:hover {
    background-color: var(--mas-hover-bg);
}

/* Active Reading Underline (Harakat-safe offset for Arabic script) */
.mas-active {
    text-decoration-line: underline !important;
    text-decoration-style: solid !important;
    text-decoration-color: var(--mas-underline-color) !important;
    text-decoration-thickness: var(--mas-underline-thickness) !important;
    text-underline-offset: var(--mas-underline-offset) !important;
    -webkit-text-decoration-line: underline !important;
    -webkit-text-decoration-color: var(--mas-underline-color) !important;
}

.mas-with-bg .mas-active {
    background-color: var(--mas-active-bg);
    box-shadow: 0 0 0 2px var(--mas-active-bg);
}

/* Reader Floating Utility Bar */
.mas-reader-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0.65rem 0 1rem 0;
    padding: 0.5rem 0.9rem;
    border-radius: 10px;
    background: rgba(13, 148, 136, 0.09);
    border: 1px solid rgba(13, 148, 136, 0.28);
    font-size: 0.88rem;
    direction: rtl;
}

.mas-reader-controls label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    margin: 0;
    user-select: none;
    font-weight: 500;
}

.mas-nudge-group {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.mas-mini-btn {
    appearance: none;
    border: 1px solid rgba(13, 148, 136, 0.4);
    background: rgba(13, 148, 136, 0.12);
    color: inherit;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.mas-mini-btn:hover {
    background: rgba(13, 148, 136, 0.24);
}

.mas-offset-display {
    font-size: 0.78rem;
    font-weight: 700;
    min-width: 3.2rem;
    text-align: center;
    direction: ltr;
    display: inline-block;
}

/* Admin Tap-to-Sync Studio Toolbar */
.mas-studio-toolbar {
    direction: rtl;
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid #1e293b;
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    margin: 0.75rem 0 1.25rem 0;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    font-family: inherit;
    text-align: right;
}

.mas-studio-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #334155;
}

.mas-studio-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #2dd4bf;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mas-studio-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.mas-btn {
    appearance: none;
    border: 1px solid #475569;
    background: #1e293b;
    color: #f8fafc;
    padding: 0.38rem 0.75rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mas-btn:hover:not(:disabled) {
    background: #334155;
    border-color: #64748b;
}

.mas-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mas-btn-primary {
    background: #0d9488;
    border-color: #14b8a6;
    color: #ffffff;
}

.mas-btn-primary:hover:not(:disabled) {
    background: #0f766e;
}

.mas-btn-record.is-recording {
    background: #dc2626;
    border-color: #ef4444;
    color: #ffffff;
}

.mas-studio-status {
    font-size: 0.84rem;
    color: #cbd5e1;
    margin-top: 0.45rem;
    line-height: 1.6;
}

.mas-next-target {
    outline: 2px dashed #f59e0b !important;
    outline-offset: 3px !important;
    background-color: rgba(245, 158, 11, 0.12) !important;
}
