/**
 * 阿里云视频直播 - 前端样式
 * 适配子比主题及通用WordPress主题
 */

/* ==================== 直播大厅 ==================== */
.alicloud-live-hall {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.live-hall-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

.live-hall-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.live-hall-title i {
    color: #ff6b6b;
    margin-right: 8px;
}

.live-hall-count {
    color: #999;
    font-size: 14px;
}

/* 直播间卡片网格 */
.live-room-grid {
    display: grid;
    gap: 20px;
}

.live-room-grid.columns-2 { grid-template-columns: repeat(2, 1fr); }
.live-room-grid.columns-3 { grid-template-columns: repeat(3, 1fr); }
.live-room-grid.columns-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .live-room-grid.columns-2,
    .live-room-grid.columns-3,
    .live-room-grid.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .live-room-grid.columns-2,
    .live-room-grid.columns-3,
    .live-room-grid.columns-4 {
        grid-template-columns: 1fr;
    }
}

/* 直播间卡片 */
.live-room-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.live-room-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.room-cover-wrap {
    display: block;
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: #1a1a2e;
    overflow: hidden;
}

.room-cover-wrap img {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.room-cover-placeholder {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: rgba(255,255,255,0.6);
    font-size: 48px;
}

.room-status-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.room-status-badge.live {
    background: #ff4757;
    animation: live-pulse 2s infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.room-status-badge.waiting {
    background: rgba(0,0,0,0.6);
}

.room-viewers {
    position: absolute;
    bottom: 10px;
    right: 10px;
    padding: 4px 8px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
}

.room-info {
    padding: 12px 16px;
}

.room-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
}

.room-title a {
    color: #333;
    text-decoration: none;
}

.room-title a:hover {
    color: #667eea;
}

.room-author {
    font-size: 13px;
    color: #999;
}

.alicloud-verified-badge {
    font-size: 11px;
    margin-left: 6px;
}

/* 空状态 */
.live-hall-empty {
    text-align: center;
    padding: 80px 20px;
    color: #999;
}

.live-hall-empty .empty-icon {
    font-size: 64px;
    color: #ddd;
    margin-bottom: 16px;
}

/* 分页 */
.live-hall-pagination {
    margin-top: 30px;
    text-align: center;
}

.live-hall-pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 4px;
    border-radius: 6px;
    background: #f5f5f5;
    color: #666;
    text-decoration: none;
    transition: all 0.2s;
}

.live-hall-pagination .page-numbers.current {
    background: #667eea;
    color: #fff;
}

.live-hall-pagination .page-numbers:hover {
    background: #e0e0e0;
}

/* ==================== 直播间详情页 ==================== */
.alicloud-live-room {
    display: flex;
    max-width: 1400px;
    margin: 20px auto;
    gap: 20px;
}

@media (max-width: 900px) {
    .alicloud-live-room {
        flex-direction: column;
        padding: 0 10px;
    }
}

/* 播放器区域 */
.live-player-section {
    flex: 1;
    min-width: 0;
}

.player-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16/9;
}

.dplayer {
    border-radius: 12px;
}

/* 等待/结束状态 */
.player-waiting,
.player-finished,
.player-banned {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #fff;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.player-waiting .waiting-icon,
.player-finished .finished-icon,
.player-banned .banned-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.player-waiting .waiting-icon { color: #ffc107; }
.player-finished .finished-icon { color: #2ed573; }
.player-banned .banned-icon { color: #ff4757; }

.waiting-tip {
    color: #aaa;
    margin-top: 8px;
}

.waiting-cover {
    max-width: 80%;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 20px;
    opacity: 0.6;
}

/* 弹幕输入栏 */
.danmaku-input-bar {
    display: flex;
    gap: 10px;
    padding: 12px 0;
}

#danmaku-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#danmaku-input:focus {
    border-color: #667eea;
}

.danmaku-send-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.danmaku-send-btn:hover {
    opacity: 0.9;
}

/* 侧边栏 */
.live-sidebar {
    width: 360px;
    flex-shrink: 0;
}

@media (max-width: 900px) {
    .live-sidebar { width: 100%; }
}

.sidebar-section {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.host-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.host-avatar img {
    border-radius: 50%;
    width: 60px;
    height: 60px;
}

.host-detail {
    flex: 1;
}

.host-detail h4 {
    margin: 0 0 4px;
    font-size: 16px;
}

.host-stats {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: #999;
}

.room-detail-title {
    margin: 0 0 10px;
    font-size: 18px;
    color: #333;
}

.room-description {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.room-announcement h4 {
    margin: 0 0 10px;
    color: #ff6b6b;
    font-size: 15px;
}

.announcement-content {
    background: #fff5f5;
    border-left: 3px solid #ff6b6b;
    padding: 10px 12px;
    border-radius: 0 6px 6px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

/* 弹幕列表 */
.danmaku-list {
    max-height: 300px;
    overflow-y: auto;
}

.danmaku-list .danmaku-item {
    padding: 6px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
    line-height: 1.5;
}

.danmaku-item .danmaku-user {
    color: #667eea;
    font-weight: 600;
    margin-right: 6px;
}

.danmaku-item .danmaku-time {
    color: #ccc;
    font-size: 11px;
    margin-left: 8px;
}

.danmaku-empty {
    text-align: center;
    color: #ccc;
    padding: 20px;
    font-size: 14px;
}

/* ==================== 用户中心 ==================== */
.alicloud-user-live {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.user-live-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.user-live-header h2 {
    margin: 0;
    font-size: 24px;
}

.btn-live-create {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff !important;
    border-radius: 8px;
    text-decoration: none !important;
    font-weight: 600;
    transition: opacity 0.2s;
}

.btn-live-create:hover {
    opacity: 0.9;
}

/* 实名认证区 */
.realname-section {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.realname-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    margin-bottom: 10px;
}

.realname-status.verified { color: #2ed573; }
.realname-status.pending  { color: #ffc107; }
.realname-status.none     { color: #ff4757; }

.realname-form {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-top: 16px;
}

.realname-form h4 {
    margin: 0 0 16px;
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.form-group .required {
    color: #ff4757;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-input:focus,
.form-textarea:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.btn-submit,
.btn-realname-verify,
.btn-check-status {
    display: inline-block;
    padding: 10px 24px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-submit:hover,
.btn-realname-verify:hover,
.btn-check-status:hover {
    background: #5a6fd6;
}

.btn-cancel {
    display: inline-block;
    padding: 10px 24px;
    background: #f0f0f0;
    color: #666;
    border-radius: 8px;
    text-decoration: none;
    margin-left: 10px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-result {
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
}

.form-result.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.form-result.error {
    background: #ffebee;
    color: #c62828;
}

/* 房间管理 */
.live-manage-room {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.push-info-section,
.pull-info-section {
    margin: 24px 0;
    padding: 16px;
    background: #f9f9f9;
    border-radius: 8px;
}

.push-info-section h4,
.pull-info-section h4 {
    margin: 0 0 16px;
    font-size: 16px;
    color: #333;
}

.push-info-section .tip {
    color: #ff4757;
    font-size: 13px;
    font-weight: normal;
}

.info-item {
    margin-bottom: 12px;
}

.info-item label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #777;
    margin-bottom: 4px;
}

.copy-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.copy-row code {
    flex: 1;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 12px;
    word-break: break-all;
    color: #333;
}

.copy-row code.secret {
    background: #fff8e1;
    border-color: #ffe082;
}

.btn-copy {
    padding: 8px 14px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.room-actions {
    margin-top: 24px;
}

.btn-view-room,
.btn-start-live,
.btn-stop-live,
.btn-delete-live {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    margin-right: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn-view-room {
    background: #f0f0f0;
    color: #666;
}

.btn-start-live {
    background: #2ed573;
    color: #fff;
}

.btn-stop-live {
    background: #ff4757;
    color: #fff;
}

.btn-back {
    display: inline-block;
    margin-top: 16px;
    color: #667eea;
    text-decoration: none;
}

/* 房间列表 */
.live-room-empty {
    text-align: center;
    padding: 80px 20px;
}

.live-room-table .room-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.room-table th,
.room-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.room-table th {
    background: #f9f9f9;
    font-weight: 600;
    font-size: 13px;
    color: #888;
    text-transform: uppercase;
}

.room-table td {
    font-size: 14px;
}

.status-label {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.status-label.status-waiting  { background: #fff3cd; color: #856404; }
.status-label.status-live     { background: #ffe0e0; color: #c0392b; }
.status-label.status-finished { background: #d4edda; color: #155724; }
.status-label.status-banned   { background: #e2e3e5; color: #383d41; }

.btn-sm {
    display: inline-block;
    padding: 4px 12px;
    background: #667eea;
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
    text-decoration: none;
}

/* 未登录 */
.alicloud-live-login-required {
    text-align: center;
    padding: 80px 20px;
}

.alicloud-live-login-required .login-icon {
    font-size: 64px;
    color: #ddd;
    margin-bottom: 16px;
}

.alicloud-live-login-required .btn-login {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 30px;
    background: #667eea;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
}

/* 错误信息 */
.alicloud-live-error {
    text-align: center;
    padding: 40px;
    color: #999;
}

.alicloud-message {
    padding: 16px;
    border-radius: 8px;
    margin: 16px 0;
}

.alicloud-message.error {
    background: #ffebee;
    color: #c62828;
}

.alicloud-message.success {
    background: #e8f5e9;
    color: #2e7d32;
}

/* ==================== 自定义中央弹窗 Toast ==================== */

.alicloud-toast-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.45);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: alicloud-fade-in 0.2s ease;
}

@keyframes alicloud-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.alicloud-toast-box {
    background: #fff;
    border-radius: 16px;
    padding: 32px 28px 24px;
    min-width: 300px;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: alicloud-toast-pop 0.25s ease;
}

@keyframes alicloud-toast-pop {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.alicloud-toast-icon {
    font-size: 48px;
    margin-bottom: 12px;
    line-height: 1;
}

.alicloud-toast-icon.success  { color: #2ed573; }
.alicloud-toast-icon.error    { color: #ff4757; }
.alicloud-toast-icon.warning  { color: #ffa502; }
.alicloud-toast-icon.info     { color: #667eea; }

.alicloud-toast-msg {
    font-size: 15px;
    color: #333;
    line-height: 1.6;
    margin-bottom: 20px;
    word-break: break-word;
}

.alicloud-toast-btn {
    display: inline-block;
    padding: 10px 40px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.alicloud-toast-btn:hover { opacity: 0.85; }

.alicloud-toast-btn.ghost {
    background: transparent;
    color: #999;
    border: 1px solid #e0e0e0;
}
