/* =============================================
   LOREM IPSUM GENERATOR — CLEAN MODERN UI
   Glassmorphism + Responsive + Accessible
   ============================================= */

.li-main-card {
    --li-accent: var(--accent, #ff6b4a);
    --li-radius: var(--radius, 12px);
    --li-radius-sm: var(--radius-sm, 8px);
}

/* ─── Controls ─── */
.li-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

/* ─── Mode Buttons (Radio Group) ─── */
.li-mode-group {
    display: flex;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--li-radius-sm);
    overflow: hidden;
}
.li-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 0.9rem;
    background: transparent;
    border: none;
    border-right: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
    position: relative;
}
.li-mode-btn:last-child {
    border-right: none;
}
.li-mode-btn:hover {
    background: var(--accent-light);
    color: var(--text);
}
.li-mode-btn.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}
.li-mode-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    z-index: 2;
}

/* ─── Count ─── */
.li-count-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.li-count-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
.li-count-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--li-radius-sm);
    overflow: hidden;
    background: var(--bg-glass);
}
.li-count-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 36px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.li-count-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
}
.li-count-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}
.li-count-input-wrap input[type="number"] {
    width: 58px;
    height: 36px;
    padding: 0 0.3rem;
    border: none;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.92rem;
    font-weight: 700;
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
}
.li-count-input-wrap input[type="number"]::-webkit-outer-spin-button,
.li-count-input-wrap input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.li-count-input-wrap input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

/* ─── Options Checkboxes ─── */
.li-options {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}
.li-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}
.li-checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.li-checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: var(--bg-glass);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
    position: relative;
}
.li-checkbox-custom::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.12s;
}
.li-checkbox-label input:checked + .li-checkbox-custom {
    background: var(--accent);
    border-color: var(--accent);
}
.li-checkbox-label input:checked + .li-checkbox-custom::after {
    opacity: 1;
}
.li-checkbox-label input:focus-visible + .li-checkbox-custom {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ─── Generate Button ─── */
.li-generate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--li-radius-sm);
    font-family: var(--font);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px var(--accent-glow);
    white-space: nowrap;
}
.li-generate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-glow);
    filter: brightness(1.08);
}
.li-generate-btn:active {
    transform: translateY(0);
    filter: brightness(0.95);
}
.li-generate-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* ─── Output Section ─── */
.li-output-section {
    margin-bottom: 0.75rem;
}
.li-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}
.li-output-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.li-output-stats {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    font-weight: 500;
}
.li-textarea-wrap {
    position: relative;
}
.li-textarea-wrap textarea {
    width: 100%;
    min-height: 220px;
    padding: 1rem;
    padding-bottom: 2.5rem;
    border: 2px solid var(--border);
    border-radius: var(--li-radius);
    background: var(--bg-card);
    color: var(--text);
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 0.95rem;
    line-height: 1.8;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: block;
    cursor: default;
}
.li-textarea-wrap textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.li-textarea-wrap textarea.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239,68,68,0.15);
}
.li-textarea-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0.3rem 1rem;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    pointer-events: none;
    user-select: none;
}
.error-message {
    color: #ef4444;
    font-size: 0.8rem;
    display: none;
    margin-top: 0.35rem;
    font-weight: 500;
}

/* ─── Action Buttons ─── */
.li-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.li-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--li-radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}
.li-action-btn:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--accent-glow);
}
.li-action-btn:active {
    transform: translateY(0);
}
.li-action-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.li-action-copy {
    border-color: var(--accent);
    color: var(--accent);
}
.li-action-regenerate {
    margin-left: auto;
}
.li-action-clear:hover {
    border-color: #ef4444;
    background: rgba(239,68,68,0.08);
    color: #ef4444;
    box-shadow: 0 2px 8px rgba(239,68,68,0.2);
}

/* ─── History ─── */
.li-history-section {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}
.li-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}
.li-history-header h4 {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0;
}
.li-clear-history {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--li-radius-sm);
    background: var(--bg-glass);
    font-family: var(--font);
    transition: all 0.15s;
}
.li-clear-history:hover {
    color: #ef4444;
    border-color: #ef4444;
    background: rgba(239,68,68,0.06);
}
.li-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.li-history-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.7rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--li-radius-sm);
    cursor: pointer;
    transition: all 0.18s;
}
.li-history-item:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}
.li-history-icon {
    font-size: 1rem;
    flex-shrink: 0;
}
.li-history-info {
    flex: 1;
    min-width: 0;
}
.li-history-text {
    font-weight: 600;
    font-size: 0.74rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.li-history-meta {
    font-size: 0.63rem;
    color: var(--text-tertiary);
}
.li-no-data {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-tertiary);
    font-size: 0.82rem;
}
.li-char-count {
    font-size: 0.68rem;
    color: var(--text-tertiary);
}

/* ─── Toast ─── */
.li-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(1rem);
    background: var(--accent);
    color: #fff;
    padding: 0.7rem 1.4rem;
    border-radius: 100px;
    font-size: 0.84rem;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16,1,0.3,1);
    pointer-events: none;
    box-shadow: 0 8px 28px var(--accent-glow);
    white-space: nowrap;
}
.li-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.li-toast.error {
    background: #ef4444;
    box-shadow: 0 8px 28px rgba(239,68,68,0.35);
}

/* =============================================
   RESPONSIVE BREAKPOINTS
   ============================================= */

/* Tablet (768px - 1023px) */
@media (max-width: 1023px) {
    .li-controls {
        gap: 0.6rem;
    }
    .li-mode-btn {
        padding: 0.5rem 0.7rem;
        font-size: 0.78rem;
    }
    .li-textarea-wrap textarea {
        min-height: 180px;
    }
}

/* Small Tablet / Large Phone (640px - 767px) */
@media (max-width: 767px) {
    .calc-card.li-main-card {
        padding: 20px;
    }
    .li-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .li-mode-group {
        width: 100%;
        justify-content: center;
    }
    .li-mode-btn {
        flex: 1;
        justify-content: center;
        font-size: 0.76rem;
        padding: 0.5rem 0.45rem;
    }
    .li-count-group {
        justify-content: center;
    }
    .li-options {
        justify-content: center;
    }
    .li-generate-btn {
        width: 100%;
        justify-content: center;
    }
    .li-actions {
        justify-content: center;
    }
    .li-action-btn {
        font-size: 0.78rem;
        padding: 0.5rem 0.75rem;
    }
    .li-action-regenerate {
        margin-left: 0;
    }
    .li-textarea-wrap textarea {
        min-height: 160px;
        font-size: 0.88rem;
        padding: 0.85rem;
        padding-bottom: 2.2rem;
    }
}

/* Small Phone (480px and below) */
@media (max-width: 480px) {
    .calc-card.li-main-card {
        padding: 16px;
    }
    .li-mode-btn {
        font-size: 0.7rem;
        padding: 0.45rem 0.3rem;
        gap: 0.2rem;
    }
    .li-mode-btn span {
        display: inline;
    }
    .li-mode-btn svg {
        width: 14px;
        height: 14px;
    }
    .li-count-input-wrap input[type="number"] {
        width: 48px;
        height: 32px;
        font-size: 0.82rem;
    }
    .li-count-btn {
        width: 28px;
        height: 32px;
    }
    .li-generate-btn {
        font-size: 0.84rem;
        padding: 0.6rem 1rem;
    }
    .li-textarea-wrap textarea {
        min-height: 140px;
        font-size: 0.84rem;
        padding: 0.7rem;
        padding-bottom: 2rem;
    }
    .li-action-btn {
        font-size: 0.72rem;
        padding: 0.45rem 0.6rem;
        gap: 0.25rem;
    }
    .li-action-btn span {
        display: inline;
    }
    .li-history-item {
        padding: 0.4rem 0.55rem;
    }
    .li-history-text {
        font-size: 0.68rem;
    }
    .li-toast {
        bottom: 5rem;
        padding: 0.55rem 1rem;
        font-size: 0.76rem;
    }
}

/* Extra Small (380px and below) */
@media (max-width: 380px) {
    .li-mode-btn span {
        display: none;
    }
    .li-mode-btn {
        padding: 0.5rem 0.4rem;
    }
    .li-mode-btn svg {
        width: 18px;
        height: 18px;
    }
    .li-action-btn span {
        display: none;
    }
    .li-action-btn {
        padding: 0.5rem;
    }
}