/**
 * Qifu Fangsheng Frontend Styles
 */

/* ===========================
   Common Styles
   =========================== */

.qifu-user-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: #2271b1;
}

.qifu-message {
    padding: 15px;
    margin: 20px 0;
    border-radius: 5px;
    text-align: center;
    font-weight: 500;
}

.qifu-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.qifu-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.qifu-actions {
    margin-top: 30px;
    text-align: center;
}

.qifu-button {
    display: inline-block;
    padding: 12px 30px;
    margin: 5px;
    background: #2271b1;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
    transition: background 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.qifu-button:hover {
    background: #135e96;
    color: #fff;
}

.qifu-button-secondary {
    background: #6c757d;
}

.qifu-button-secondary:hover {
    background: #545b62;
}

/* ===========================
   Wooden Fish Page
   =========================== */

.qifu-wooden-fish-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.qifu-wooden-fish-main {
    text-align: center;
    margin: 120px 0 40px 0;
    position: relative;
}

/* Wooden Fish Container */
.wooden-fish-container {
    width: 200px;
    height: 200px;
    position: relative;
    display: inline-block;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.wooden-fish-display {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #d2691e 0%, #8b4513 50%, #654321 100%);
    border-radius: 50%;
    filter: drop-shadow(0 15px 25px rgba(0,0,0,.45));
    transition: transform .15s cubic-bezier(.4,0,.2,1);
}

.wooden-fish-container.knock .wooden-fish-display {
    transform: scale(.96) rotate(-1.5deg);
    filter: drop-shadow(0 8px 18px rgba(0,0,0,.55)) brightness(.88);
}

.mokugyo-image {
    max-width: 80%;
    max-height: 80%;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
}

/* Hammer */
.qifu-hammer {
    position: absolute;
    top: -80px;
    right: calc(50% - 160px);
    width: 80px;
    height: 100px;
    transform-origin: bottom center;
    z-index: 10;
}

.qifu-hammer.knock {
    animation: hammerKnock .4s ease-out;
}

.hammer-head {
    width: 25px;
    height: 35px;
    background: linear-gradient(145deg, #4a4a4a, #2a2a2a);
    border-radius: 50% 50% 30% 30%;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 5px 15px rgba(0,0,0,.5), inset 0 -3px 8px rgba(0,0,0,.3);
}

.hammer-handle {
    width: 6px;
    height: 70px;
    background: linear-gradient(to bottom, #8B4513, #654321);
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 3px;
    box-shadow: 0 0 8px rgba(0,0,0,.4), inset 1px 0 2px rgba(255,255,255,.2);
}

@keyframes hammerKnock {
    0% { transform: rotate(-45deg); }
    40% { transform: rotate(15deg); }
    60% { transform: rotate(-5deg); }
    80% { transform: rotate(5deg); }
    100% { transform: rotate(0); }
}

/* Hit Effects */
.hit-effect,
.sound-wave {
    position: absolute;
    top: 50%;
    left: 50%;
    pointer-events: none;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
}

.hit-effect {
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(255,215,0,.8) 0%, rgba(255,215,0,.3) 40%, transparent 70%);
}

.sound-wave {
    width: 100px;
    height: 100px;
    border: 3px solid rgba(255,215,0,.8);
}

.hit-effect.show {
    animation: hitEffect .6s ease-out;
}

.sound-wave.show {
    animation: soundWave .8s ease-out;
}

@keyframes hitEffect {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(.3);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

@keyframes soundWave {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(.5);
        border-width: 3px;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2.5);
        border-width: 1px;
    }
}

.wooden-fish-hint {
    margin-top: 30px;
    font-size: 16px;
    color: #666;
}

/* ===========================
   Fish Release Page
   =========================== */

.qifu-fish-release-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.qifu-fish-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.fish-option {
    text-align: center;
    padding: 30px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.fish-option:hover {
    border-color: #2271b1;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transform: translateY(-5px);
}

.fish-option .fish-emoji {
    font-size: 80px;
    margin-bottom: 15px;
}

.fish-option h3 {
    margin: 10px 0;
    font-size: 24px;
    color: #333;
}

.fish-cost {
    font-size: 18px;
    color: #2271b1;
    font-weight: bold;
    margin: 10px 0;
}

.fish-merit {
    font-size: 14px;
    color: #28a745;
    margin: 5px 0 15px;
}

/* ===========================
   Leaderboard Page
   =========================== */

.qifu-leaderboard-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.qifu-user-rank {
    background: #e7f3ff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    text-align: center;
}

.qifu-user-rank p {
    margin: 5px 0;
    font-size: 18px;
}

.qifu-leaderboard-table {
    overflow-x: auto;
    margin-bottom: 30px;
}

#qifu-leaderboard {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

#qifu-leaderboard thead {
    background: #2271b1;
    color: #fff;
}

#qifu-leaderboard th,
#qifu-leaderboard td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

#qifu-leaderboard tr:hover {
    background: #f8f9fa;
}

#qifu-leaderboard tr.top-rank-1 {
    background: #fff3cd;
}

#qifu-leaderboard tr.top-rank-2 {
    background: #e2e3e5;
}

#qifu-leaderboard tr.top-rank-3 {
    background: #f8d7da;
}

/* ===========================
   Member Center Page
   =========================== */

.qifu-member-center-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.qifu-member-profile {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.qifu-member-profile h3 {
    margin-top: 0;
}

.qifu-member-stats {
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: #2271b1;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.stat-card .stat-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.stat-card .stat-content {
    display: flex;
    flex-direction: column;
}

.stat-card .stat-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #2271b1;
}

/* ===========================
   Responsive Design
   =========================== */

@media (max-width: 768px) {
    .qifu-user-stats {
        flex-direction: column;
        gap: 15px;
    }

    .qifu-wooden-fish-main {
        margin: 90px 0 30px 0;
    }

    .wooden-fish-container {
        width: 160px;
        height: 160px;
    }

    .mokugyo-image {
        max-width: 75%;
        max-height: 75%;
    }

    .qifu-hammer {
        width: 60px;
        height: 80px;
        top: -60px;
        right: calc(50% - 120px);
    }

    .hammer-head {
        width: 20px;
        height: 28px;
    }

    .hammer-handle {
        width: 5px;
        height: 55px;
    }

    .qifu-fish-options {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    #qifu-leaderboard {
        font-size: 14px;
    }

    #qifu-leaderboard th,
    #qifu-leaderboard td {
        padding: 8px;
    }
}

/* ===========================
   Video Player Modal
   =========================== */

.qifu-video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qifu-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

.qifu-video-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 10001;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.qifu-release-video {
    display: block;
    width: 100%;
    height: auto;
    max-width: 1280px;
    max-height: 90vh;
    object-fit: contain;
}

.qifu-video-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.qifu-video-close:hover {
    background: rgba(255, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .qifu-video-container {
        max-width: 95vw;
        max-height: 80vh;
    }

    .qifu-release-video {
        max-height: 80vh;
    }

    .qifu-video-close {
        width: 35px;
        height: 35px;
        font-size: 20px;
        top: 5px;
        right: 5px;
    }
}
