/* ==========================================================================
   Font Preview — Frontend Widget Styles
   ========================================================================== */

.fp-widget-group {
    display: block;
    width: 100%;
    clear: both;
    box-sizing: border-box;
    margin: 20px 0;
    font-family: inherit;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 18px 20px;
    background: #fafafa;
}

.fp-widget {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 12px;
}

/* --- Preview image box --- */
.fp-preview-area {
    margin-bottom: 10px;
}

.fp-image-box {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 110px;
    background: #ffffff;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    overflow: hidden;
    cursor: text;
}

.fp-image-box--has-image {
    min-height: 0;
}

.fp-preview-img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* --- Loading spinner --- */
.fp-spinner {
    display: none;
    width: 34px;
    height: 34px;
    border: 3px solid #e0e0e0;
    border-top-color: #555;
    border-radius: 50%;
    animation: fp-spin 0.75s linear infinite;
    position: absolute;
}

@keyframes fp-spin {
    to { transform: rotate(360deg); }
}

/* --- Placeholder (before first render) --- */
.fp-placeholder {
    text-align: center;
    color: #aaa;
    font-size: 14px;
    padding: 20px 30px;
    pointer-events: none;
    user-select: none;
}

/* --- Input area --- */
.fp-input-area {
    position: relative;
}

.fp-text-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    color: #333;
}

.fp-text-input:focus {
    border-color: #4a90d9;
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2);
}

/* --- Char counter --- */
.fp-char-count {
    text-align: right;
    font-size: 11px;
    color: #aaa;
    margin-top: 3px;
}

/* --- No-font error state --- */
.fp-no-font {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 4px;
    padding: 10px 16px;
    color: #795548;
    font-size: 14px;
    margin: 12px 0;
}

/* ==========================================================================
   Controls: font-size slider + case buttons
   ========================================================================== */

.fp-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

/* Size slider row */
.fp-size-control {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 180px;
}

.fp-size-label {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
    flex-shrink: 0;
}

.fp-size-value {
    font-weight: 700;
    color: #222;
}

.fp-size-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: #ddd;
    outline: none;
    cursor: pointer;
    accent-color: var(--fp-brand, #2271b1);
}

.fp-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--fp-brand, #2271b1);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--fp-brand, #2271b1);
}

.fp-size-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--fp-brand, #2271b1);
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--fp-brand, #2271b1);
}

/* Case buttons */
.fp-case-control {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.fp-case-btn {
    padding: 4px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f6f7f7;
    color: #555;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.fp-case-btn:hover {
    border-color: var(--fp-brand, #2271b1);
    color: var(--fp-brand, #2271b1);
    background: #f0f6fc;
}

.fp-case-btn--active {
    background: var(--fp-brand, #2271b1);
    border-color: var(--fp-brand, #2271b1);
    color: #fff;
}

.fp-case-btn--active:hover {
    background: var(--fp-brand, #135e96);
    border-color: var(--fp-brand, #135e96);
    color: #fff;
}

/* ==========================================================================
   View Glyphs button
   ========================================================================== */

.fp-glyphs-btn {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 12px;
    border: 1px solid #b0b0b0;
    border-radius: 4px;
    background: #fff;
    color: #444;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

.fp-glyphs-btn:hover {
    background: #f0f6fc;
    border-color: var(--fp-brand, #2271b1);
    color: var(--fp-brand, #2271b1);
}

/* ==========================================================================
   Glyph popup modal
   ========================================================================== */

.fp-glyph-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fp-glyph-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.fp-glyph-modal__box {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.22);
    width: 96vw;
    max-width: 1200px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fp-glyph-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
}

.fp-glyph-modal__title {
    font-size: 16px;
    font-weight: 700;
    color: #1d2327;
}

.fp-glyph-modal__count {
    font-size: 13px;
    color: #888;
    margin-left: 8px;
    font-weight: 400;
}

.fp-glyph-modal__close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #888;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s;
}

.fp-glyph-modal__close:hover {
    color: #d63638;
}

.fp-glyph-modal__body {
    overflow-y: auto;
    padding: 16px;
    flex: 1;
    display: block;
    min-height: 120px;
}

/* Glyph grid */
.fp-glyph-modal__grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.fp-glyph-cell {
    width: 108px;
    height: 132px;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: default;
    background: #fff;
    transition: border-color 0.12s, background 0.12s;
    position: relative;
    flex-shrink: 0;
}

.fp-glyph-cell:hover {
    border-color: var(--fp-brand, #2271b1);
    background: #f0f6fc;
    z-index: 1;
}

.fp-glyph-cell__char {
    font-size: 52px;
    line-height: 1.2;
    color: #222;
    pointer-events: none;
    user-select: none;
}

.fp-glyph-cell__code {
    font-size: 11px;
    color: #aaa;
    font-family: monospace;
    pointer-events: none;
    user-select: none;
    letter-spacing: 0;
}

.fp-glyph-modal__spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: var(--fp-brand, #2271b1);
    border-radius: 50%;
    animation: fp-spin 0.75s linear infinite;
    margin: 40px auto;
    flex-shrink: 0;
}

.fp-glyph-modal__img {
    display: block;
    max-width: 100%;
    height: auto;
}

.fp-glyph-modal__msg {
    color: #d63638;
    font-size: 14px;
    margin: 40px auto;
    text-align: center;
}

/* Hover tooltip — hex code only */
.fp-glyph-tooltip {
    position: fixed;
    z-index: 100000;
    background: rgba(30,30,30,0.85);
    color: #fff;
    border-radius: 4px;
    padding: 4px 8px;
    pointer-events: none;
    font-size: 11px;
    font-family: monospace;
    white-space: nowrap;
}

.fp-glyph-tooltip__code {
    font-size: 11px;
    font-family: monospace;
}

/* Prevent body scroll while modal open */
body.fp-modal-open {
    overflow: hidden;
}
