/**
 * Simple Article Reader 精美视觉版
 * 毛玻璃渐变设计 + 朗读脉冲动画
 */
.sar-toolbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 60px;                /* 超大圆角，胶囊风格 */
    padding: 12px 20px;
    margin: 24px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.05);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: box-shadow 0.3s ease, background 0.3s ease;
}

/* 浮动工具栏（通过短代码触发） */
.sar-float-bottom {
    position: fixed;
    bottom: 20px;
    left: 10px;
    right: 10px;
    z-index: 9999;
    margin: 0;
    animation: sar-slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.sar-float-top {
    position: fixed;
    top: 20px;
    left: 10px;
    right: 10px;
    z-index: 9999;
    margin: 0;
    animation: sar-slide-down 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sar-slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes sar-slide-down {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* 按钮基本样式 */
.sar-button {
    border: none;
    color: #fff;
    padding: 14px 20px;
    border-radius: 40px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.1);
    line-height: 1;
    min-width: 70px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    flex: 1 1 auto;
    max-width: 130px;
    background-size: 200% auto;          /* 用于悬停渐变流动 */
    background-position: left center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* 各按钮独立渐变 */
.sar-play {
    background-image: linear-gradient(145deg, #007cba 0%, #005a8c 100%);
}
.sar-pause {
    background-image: linear-gradient(145deg, #fd7e14 0%, #e06b0d 100%);
}
.sar-resume {
    background-image: linear-gradient(145deg, #28a745 0%, #1e7e34 100%);
}
.sar-stop {
    background-image: linear-gradient(145deg, #dc3545 0%, #b02a37 100%);
}

.sar-button:hover {
    background-position: right center;   /* 渐变流动效果 */
    transform: scale(1.02);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}
.sar-button:active {
    transform: scale(0.96);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.sar-button:focus-visible {
    outline: 3px solid #007cba;
    outline-offset: 2px;
}

/* 状态栏 */
.sar-status {
    font-size: 15px;
    font-weight: 500;
    color: #1e293b;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 10px 20px;
    border-radius: 40px;
    margin-left: 5px;
    flex: 2 1 auto;
    text-align: center;
    min-width: 120px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid rgba(255,255,255,0.3);
    transition: background 0.3s ease;
}

/* 朗读时的脉冲动画 */
.sar-speaking .sar-status {
    background: rgba(0, 124, 186, 0.15);
    box-shadow: 0 0 15px rgba(0, 124, 186, 0.4), inset 0 0 8px rgba(255,255,255,0.5);
    animation: sar-pulse 1.5s infinite ease-in-out;
}

@keyframes sar-pulse {
    0% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.02); box-shadow: 0 0 25px rgba(0, 124, 186, 0.6); }
    100% { opacity: 0.8; transform: scale(1); }
}

/* 错误信息 */
.sar-error {
    color: #b91c1c;
    background: rgba(254, 202, 202, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: 40px;
    padding: 14px 20px;
    width: 100%;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.2);
}

/* 内容区域（无样式干扰） */
.sar-content {
    clear: both;
}

/* 移动端优化 */
@media (max-width: 480px) {
    .sar-toolbar {
        border-radius: 40px;
        padding: 10px 14px;
        gap: 6px;
    }
    .sar-button {
        padding: 12px 12px;
        font-size: 15px;
        min-width: 60px;
    }
    .sar-status {
        width: 100%;
        margin: 6px 0 0;
        order: 4;
        font-size: 14px;
        padding: 8px 12px;
    }
}

/* 暗色模式 */
@media (prefers-color-scheme: dark) {
    .sar-toolbar {
        background: rgba(30, 32, 38, 0.85);
        border-color: rgba(255, 255, 255, 0.15);
    }
    .sar-status {
        background: rgba(40, 42, 48, 0.8);
        color: #e2e8f0;
        border-color: rgba(255,255,255,0.1);
    }
    .sar-speaking .sar-status {
        background: rgba(0, 124, 186, 0.25);
        box-shadow: 0 0 20px rgba(0, 124, 186, 0.5);
    }
    .sar-error {
        background: rgba(127, 29, 29, 0.9);
        color: #fecaca;
        border-color: #7f1d1d;
    }
}