/**
 * Umayya Audio Recorder — Frontend Styles
 *
 * Scoped to .umayya-audio-recorder and .umayya-audio-fallback containers.
 * Uses LearnDash ld30 color variables where available.
 */

/* ----------------------------------------------------------------
   Recorder container (wraps the LD upload section)
   ---------------------------------------------------------------- */
.umayya-audio-recorder {
    position: relative;
}

/* ----------------------------------------------------------------
   Recorder UI (injected by audio-recorder.js)
   ---------------------------------------------------------------- */
.umayya-recorder-ui {
    margin-top: 16px;
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #f9f9f9;
}

/* ----------------------------------------------------------------
   Buttons
   ---------------------------------------------------------------- */
.umayya-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.umayya-btn:focus-visible {
    outline: 3px solid #4a90d9;
    outline-offset: 2px;
}

.umayya-btn-primary {
    background: #e74c3c;
    color: #fff;
    border-color: #c0392b;
}

.umayya-btn-primary:hover {
    background: #c0392b;
}

.umayya-btn-success {
    background: #27ae60;
    color: #fff;
    border-color: #1e8449;
}

.umayya-btn-success:hover {
    background: #1e8449;
}

.umayya-btn:not(.umayya-btn-primary):not(.umayya-btn-success) {
    background: #f0f0f0;
    color: #333;
    border-color: #ccc;
}

.umayya-btn:not(.umayya-btn-primary):not(.umayya-btn-success):hover {
    background: #e0e0e0;
}

/* RTL button adjustments */
[dir="rtl"] .umayya-btn {
    flex-direction: row-reverse;
}

/* ----------------------------------------------------------------
   Controls row
   ---------------------------------------------------------------- */
.umayya-recorder-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ----------------------------------------------------------------
   Timer
   ---------------------------------------------------------------- */
.umayya-recorder-timer {
    display: inline-block;
    padding: 4px 10px;
    background: #333;
    color: #fff;
    font-family: monospace;
    font-size: 1rem;
    border-radius: 4px;
    min-width: 48px;
    text-align: center;
    margin-top: 10px;
}

/* ----------------------------------------------------------------
   Playback section
   ---------------------------------------------------------------- */
.umayya-recorder-playback {
    margin-top: 12px;
}

.recorder-playback-audio {
    display: block;
    width: 100%;
    max-width: 480px;
    margin-bottom: 10px;
}

.umayya-recorder-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ----------------------------------------------------------------
   Status message (aria-live region)
   ---------------------------------------------------------------- */
.umayya-recorder-status {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #555;
    min-height: 1.4em;
}

.umayya-recorder-status:not(:empty) {
    padding: 8px 12px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 4px;
    color: #5d4037;
}

/* ----------------------------------------------------------------
   Fallback (unsupported browser)
   ---------------------------------------------------------------- */
.umayya-audio-fallback {
    padding: 16px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    margin-bottom: 16px;
}

.umayya-audio-fallback h4 {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 700;
}

.umayya-audio-fallback ul {
    margin: 8px 0 0 20px;
    padding: 0;
}

[dir="rtl"] .umayya-audio-fallback ul {
    margin-left: 0;
    margin-right: 20px;
}

/* ----------------------------------------------------------------
   Recording state — pulsing indicator on Stop button
   ---------------------------------------------------------------- */
@keyframes umayya-recording-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

.recorder-btn-stop {
    animation: umayya-recording-pulse 1.2s ease-in-out infinite;
}

/* ----------------------------------------------------------------
   Hide the native file input when recorder is active
   (JS sets data-recorder-active on the container)
   ---------------------------------------------------------------- */
.umayya-audio-recorder[data-recorder-active="1"] .ld-file-upload {
    display: none;
}
