/* public/css/hongbao.css - 红包样式文件 */

/* ================= 红包容器 ================= */
.hongbao-container {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    z-index: 1005;
    display: none;
    opacity: 0;
    transition: all 0.3s ease-in-out;
    max-width: 320px; /* 防止在小屏幕上溢出 */
}

/* 确保聊天室容器为相对定位 */
.container {
    position: relative;
    min-height: 100vh;
}

.hongbao-container.show {
    opacity: 1;
    animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateY(-50%) translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateY(-50%) translateX(0);
        opacity: 1;
    }
}

/* ================= 红包卡片 ================= */
.hongbao-card {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.3);
    width: 300px;
    color: white;
    overflow: hidden;
    position: relative;
}

.hongbao-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="20" cy="20" r="1" fill="rgba(255,255,255,0.05)"/><circle cx="80" cy="30" r="1.5" fill="rgba(255,255,255,0.08)"/></svg>');
    pointer-events: none;
}

/* ================= 红包头部 ================= */
.hongbao-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.hongbao-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
}

.hongbao-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 20px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
}

.hongbao-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ================= 红包内容 ================= */
.hongbao-content {
    padding: 20px;
    text-align: center;
}

.hongbao-icon {
    position: relative;
    margin-bottom: 15px;
}

.hongbao-emoji {
    font-size: 60px;
    display: block;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.hongbao-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

.pulse-animation .hongbao-pulse {
    animation: pulse 1s infinite;
}

/* ================= 红包信息 ================= */
.hongbao-info {
    margin-bottom: 20px;
}

.hongbao-amount,
.hongbao-count {
    font-size: 16px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 15px;
    border-radius: 10px;
    margin-bottom: 10px;
}

.hongbao-amount span,
.hongbao-count span {
    font-weight: bold;
    color: #ffd700;
}

/* ================= 倒计时 ================= */
.hongbao-countdown {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 20px;
}

.countdown-title {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.countdown-time {
    font-size: 32px;
    font-weight: bold;
    font-family: 'Monaco', 'Menlo', monospace;
    color: #ffd700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.countdown-subtitle {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 8px;
}

/* ================= 按钮 ================= */
.hongbao-actions {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.hongbao-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.hongbao-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: width 0.3s, height 0.3s, top 0.3s, left 0.3s;
    transform: translate(-50%, -50%);
}

.hongbao-btn:hover::before {
    width: 300px;
    height: 300px;
}

.hongbao-btn-claim {
    background: linear-gradient(135deg, #ffd700, #ffb347);
    color: #333;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.5);
    }
    to {
        box-shadow: 0 6px 25px rgba(255, 215, 0, 0.8);
    }
}

.hongbao-btn-claim:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.6);
}

.hongbao-btn-claim:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    animation: none;
}

.hongbao-btn-history {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.hongbao-btn-history:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* ================= 完成状态 ================= */
.hongbao-finished {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 15px;
    font-size: 16px;
    font-weight: bold;
    animation: bounce 1s ease-in-out;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* ================= 历史记录弹窗 ================= */
.hongbao-history-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1010;
    backdrop-filter: blur(5px);
}

.history-modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.history-header h3 {
    margin: 0;
    font-size: 20px;
}

.history-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
}

.history-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 20px;
}

.history-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
    transition: transform 0.2s, box-shadow 0.2s;
}

.history-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.history-amount {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.history-time {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.history-id {
    font-size: 12px;
    color: #999;
    font-family: monospace;
}

.loading,
.error,
.empty {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.error {
    color: #dc3545;
}

/* ================= 提示消息 ================= */
.hongbao-success-toast,
.hongbao-error-toast {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    z-index: 9999;
    animation: toastSlideIn 0.3s ease-out;
    max-width: 300px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.hongbao-success-toast {
    background: rgba(46, 204, 113, 0.9);
}

.hongbao-error-toast {
    background: rgba(231, 76, 60, 0.9);
}

.success-icon,
.error-icon {
    font-size: 18px;
}

.success-text,
.error-text {
    font-size: 14px;
    font-weight: 500;
}

/* ================= 金币动画 ================= */
.floating-coin {
    position: absolute;
    font-size: 20px;
    animation: coinFloat 2s ease-out forwards;
    pointer-events: none;
    z-index: 1000;
}

@keyframes coinFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-100px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-200px) scale(0.8);
    }
}

/* ================= 移动端适配 ================= */
@media (max-width: 768px) {
    .hongbao-status-btn {
        position: absolute;
        top: 10px;
        left: 10px;
        min-width: 60px;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .hongbao-status-btn .hongbao-icon {
        font-size: 16px;
    }
    
    .hongbao-status-btn .hongbao-status-text {
        display: none; /* 在小屏幕上隐藏文字 */
    }
    
    .hongbao-status-btn .hongbao-status-time {
        font-size: 10px;
    }
    
    .hongbao-container {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        right: auto;
        width: 90%;
        max-width: 320px;
        z-index: 1010;
    }
    
    .hongbao-card {
        width: 100%;
        margin: 0 auto;
    }
    
    .hongbao-content {
        padding: 15px;
    }
    
    .hongbao-emoji {
        font-size: 50px;
    }
    
    .countdown-time {
        font-size: 28px;
    }
    
    .history-modal-content {
        width: 90%;
        max-width: 400px;
        margin: 5% auto;
    }
    
    .hongbao-success-toast,
    .hongbao-error-toast {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 300px;
        z-index: 1015;
    }
}

@media (max-width: 480px) {
    .hongbao-status-btn {
        min-width: 50px;
        padding: 6px 8px;
        font-size: 10px;
    }
    
    .hongbao-status-btn .hongbao-icon {
        font-size: 14px;
    }
    
    .hongbao-status-btn .hongbao-status-text {
        display: none;
    }
    
    .hongbao-card {
        width: 100%;
        margin: 0;
    }
    
    .hongbao-header {
        padding: 12px 15px;
    }
    
    .hongbao-header h3 {
        font-size: 16px;
    }
    
    .hongbao-content {
        padding: 12px;
    }
    
    .hongbao-emoji {
        font-size: 45px;
    }
    
    .countdown-time {
        font-size: 24px;
    }
    
    .hongbao-btn {
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* ================= 桌面端适配 ================= */
@media (min-width: 769px) {
    .hongbao-container {
        position: absolute;
        top: 50%;
        right: 15px;
        transform: translateY(-50%);
        width: 300px;
        z-index: 1005;
    }
    
    .hongbao-status-btn {
        position: absolute;
        top: 15px;
        left: 15px;
        z-index: 1000;
        font-size: 16px;
        padding: 10px 15px;
        min-width: 120px;
    }
    
    /* 确保聊天室容器在桌面版也有相对定位 */
    .container {
        position: relative;
        min-height: 100vh;
    }
}

/* ================= 暗色主题适配 ================= */
@media (prefers-color-scheme: dark) {
    .history-modal-content {
        background: #2c3e50;
        color: white;
    }

    .history-item {
        background: #34495e;
        color: white;
    }

    .history-amount {
        color: #74b9ff;
    }

    .history-time {
        color: #ddd;
    }

    .history-id {
        color: #bbb;
    }

    .loading,
    .error,
    .empty {
        color: #bbb;
    }

    .hongbao-success-toast,
    .hongbao-error-toast {
        background: #2c3e50;
        color: white;
    }
}

/* ================= 滚动条样式 ================= */
.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ================= 红包状态按钮 ================= */
.hongbao-status-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    border-radius: 50px;
    padding: 12px 18px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    transition: all 0.3s ease;
    z-index: 1006;
    min-width: 100px;
    font-size: 16px;
    font-weight: bold;
}

.hongbao-status-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.hongbao-status-btn.countdown {
    background: linear-gradient(135deg, #ff9f43, #f39c12);
    animation: pulse-countdown 2s ease-in-out infinite;
}

.hongbao-status-btn.claimable {
    background: linear-gradient(135deg, #00d2d3, #01a3a4);
    animation: flash-claimable 1s ease-in-out infinite alternate;
}

@keyframes pulse-countdown {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(255, 159, 67, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 25px rgba(255, 159, 67, 0.5);
    }
}

@keyframes flash-claimable {
    0% {
        background: linear-gradient(135deg, #00d2d3, #01a3a4);
        box-shadow: 0 4px 15px rgba(0, 210, 211, 0.3);
    }
    100% {
        background: linear-gradient(135deg, #ff3838, #e55039);
        box-shadow: 0 6px 25px rgba(255, 56, 56, 0.6);
    }
}

.hongbao-status-btn .hongbao-icon {
    font-size: 20px;
    line-height: 1;
}

.hongbao-status-btn .hongbao-status-text {
    font-size: 14px;
    line-height: 1;
    font-weight: bold;
}

.hongbao-status-btn .hongbao-status-time {
    font-size: 13px;
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 8px;
    border-radius: 12px;
    line-height: 1;
    font-family: 'Monaco', 'Menlo', monospace;
    font-weight: bold;
} 