/**
 * Global Furigana (Ruby) Styles
 * These styles ensure proper display of Japanese furigana annotations throughout the application
 */

/* Basic Ruby Styling */
ruby {
    display: inline-block;
    text-align: center;
    white-space: nowrap;
    vertical-align: bottom;
    line-height: 2;
    position: relative;
}

rt {
    display: block;
    font-size: 0.5em;
    line-height: 1.2;
    text-align: center;
    margin-bottom: 0.2em;
}

rp {
    display: none;
}

/* CKEditor Furigana button styling */
.cke_button__furigana_icon {
    background: none !important;
}

.cke_button__furigana_icon:before {
    content: '振';
    font-size: 14px;
    font-weight: bold;
    color: #333;
    display: block;
    text-align: center;
    line-height: 16px;
}

.cke_button__furigana_label {
    display: inline-block;
}

/* Ensure ruby text doesn't break layout in tables */
table ruby {
    line-height: 1.8;
}

/* Styling for ruby in different contexts */
.card-body ruby,
.form-control ruby,
.table ruby {
    line-height: 1.8;
}

/* Fallback for browsers that don't support ruby */
@supports not (display: ruby) {
    ruby {
        display: inline-flex;
        flex-direction: column;
        vertical-align: 1em;
        line-height: 1;
    }
    
    rt {
        font-size: 0.5em;
        line-height: 1;
        text-align: center;
        order: -1;
    }
    
    rp {
        display: inline;
        font-size: 0.8em;
    }
}
