/**
 * AChords Frontend Styles
 * 
 * @package AChords
 */

article {
    padding-right: 10px;
}

/* Custom HTML areas (top & left) */
.achords-wrapper {
    width: 100%;
}

.achords-custom-top {
    margin-bottom: 1.5em;
    width: 100%;
}

.achords-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5em;
    align-items: flex-start;
}

.achords-custom-left {
    flex: 0 0 auto;
    min-width: 0;
}

.achords-sheet-container {
    flex: 1 1 0;
    min-width: 0;
}

.achords-sheet {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    max-width: 100%;
    overflow-x: auto;
    unicode-bidi: plaintext;
}
span[dir="rtl"] {
    font-size: 18px;
  }

.achords-section {
    margin-bottom: 2em;
}

.achords-section-title {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 1em;
    color: #555;
    text-align: right;
}

.achords-line {
    margin-bottom: 8px;
    line-height: 1.6;
    position: relative;
}

.achords-chord-line {
    font-size: 0.9em;
    color: #0066cc;
    font-weight: bold;
    min-height: 1.2em;
    line-height: 1.2;
    font-family: 'Courier New', monospace;
    position: relative;
    direction: ltr;
    unicode-bidi: plaintext;
    white-space: pre-wrap;
    tab-size: 4;
    -moz-tab-size: 4;
    margin-bottom: 2px;
}

.achords-chord-line[data-order="position"] {
    white-space: pre;
    margin-bottom: 2px;
}

.achords-chord-line[data-order="alphabetical"],
.achords-chord-line[data-order="type"] {
    white-space: normal;
    margin-bottom: 0.2em;
    text-align: right;
}

.achords-lyric-line {
    font-size: 1em;
    margin-bottom: 0;
    line-height: 1.6;
    color: #333;
    font-family: 'Courier New', monospace;
    min-height: 1.4em;
    unicode-bidi: plaintext;
    white-space: pre;
}

.achords-chord {
    direction: ltr !important;
    unicode-bidi: isolate !important;
    display: inline-block;
}

.achords-chord {
    cursor: pointer;
    color: #0066cc;
    font-weight: bold;
    text-decoration: underline;
    transition: color 0.2s ease, background-color 0.2s ease;
    position: relative;
    display: inline-block;
    padding: 2px 4px;
    margin: -2px -4px;
    border-radius: 3px;
    background:#eff6ff;
}

.achords-chord:hover {
    color: #004499;
    background-color: #f0f8ff;
}

.achords-chord.no-image {
    cursor: default;
    text-decoration: none;
}

.achords-chord.no-image:hover {
    background-color: transparent;
}

.achords-lyrics {
    display: inline;
    white-space: pre-wrap;
    unicode-bidi: plaintext;
}

/* Chord image tooltip (hover / tap) */
.achords-tooltip {
    position: fixed;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 10px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    border: 1px solid #ddd;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    max-width: 90vw;
}

.achords-tooltip.achords-tooltip-visible {
    opacity: 1;
    visibility: visible;
}

.achords-tooltip-chord-name {
    font-size: 13px;
    font-weight: bold;
    color: #0066cc;
    margin-bottom: 6px;
}

.achords-tooltip-image {
    display: block;
    max-width: 180px;
    max-height: 200px;
    width: auto;
    height: auto;
    border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .achords-sheet {
        font-size: 0.9em;
    }
    
    .achords-chord-line {
        font-size: 0.8em;
        direction: ltr;
    }
    
    .achords-lyric-line {
        font-size: 0.9em;
    }
    
    .achords-tooltip-image {
        max-width: 160px;
        max-height: 180px;
    }
}

@media (max-width: 480px) {
    .achords-sheet {
        font-size: 0.85em;
        line-height: 1.6;
    }
    
    .achords-chord-line {
        font-size: 0.75em;
        direction: ltr;
    }
    
    .achords-lyric-line {
        font-size: 0.85em;
    }
    
    .achords-tooltip-image {
        max-width: 140px;
        max-height: 160px;
    }
}

/* RTL Support */
.achords-sheet[dir="rtl"] {
    text-align: right;
    unicode-bidi: plaintext;
}

.achords-sheet[dir="rtl"] .achords-chord-line {
    direction: ltr;
    unicode-bidi: isolate;
    text-align: right;
}

.achords-sheet[dir="rtl"] .achords-lyric-line {
    text-align: right;
    direction: rtl;
}

/* LTR Support */
.achords-sheet[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

.achords-sheet[dir="ltr"] .achords-chord-line,
.achords-sheet[dir="ltr"] .achords-lyric-line {
    direction: ltr;
    text-align: left;
}

/* Rendered line wrappers inside achords-sheet */
.achords-sheet > div {
    
    unicode-bidi: isolate !important;
}

/* Force right alignment for all frontend chord sheet content */
.achords-wrapper .achords-sheet,
.achords-wrapper .achords-section-title,
.achords-wrapper .achords-line,
.achords-wrapper .achords-chord-line,
.achords-wrapper .achords-lyric-line,
.achords-wrapper .achords-lyrics {
    text-align: right !important;
}
