/**
 * 낚시의 달인 - Game Specific Styles
 * Inherits from ../css/common.css
 */

/* ===== Fishing-specific CSS Variables ===== */
:root {
    --water-color: #1a5f7a;
    --water-dark: #0d3d4d;
    --sky-gradient: linear-gradient(180deg, #87CEEB 0%, #4A90A4 50%, #1a5f7a 100%);
}

/* ===== Location Info in Game Header ===== */
.location-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

#location-name {
    font-weight: 600;
    font-size: 0.95rem;
}

#weather-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ===== Bait Indicator ===== */
.bait-indicator {
    font-size: 1.2rem;
}

.bait-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== Gold Card ===== */
.gold-card .gold-indicator {
    font-size: 1.2rem;
}

.catch-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== Control Panel (Power, Tension, HP Gauges) ===== */
.control-panel {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 20;
    pointer-events: none;
}

.gauge-wrapper {
    background: rgba(0, 0, 0, 0.7);
    border-radius: var(--radius-md);
    padding: 10px 15px;
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

.gauge-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* ===== Power Bar ===== */
.power-bar {
    height: 16px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.power-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg,
        var(--success) 0%,
        var(--warning) 50%,
        var(--danger) 100%);
    border-radius: 8px;
    transition: width 0.05s linear;
}

.power-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 4px;
    display: block;
    text-align: right;
}

/* ===== Tension Bar ===== */
.tension-bar {
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.tension-zones {
    display: flex;
    height: 100%;
    position: relative;
}

.tension-zones .zone {
    height: 100%;
}

.zone-danger-low {
    width: 20%;
    background: var(--danger);
    opacity: 0.5;
}

.zone-warning-low {
    width: 15%;
    background: var(--warning);
    opacity: 0.5;
}

.zone-optimal {
    width: 30%;
    background: var(--success);
    opacity: 0.6;
}

.zone-warning-high {
    width: 20%;
    background: var(--warning);
    opacity: 0.5;
}

.zone-danger-high {
    width: 15%;
    background: var(--danger);
    opacity: 0.5;
}

.tension-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 50%;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    transition: width 0.1s ease, background-color 0.2s ease;
}

.tension-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 4px;
    display: block;
    text-align: right;
}

/* ===== Fish HP Bar ===== */
.hp-bar {
    height: 16px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    overflow: hidden;
}

.hp-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg,
        var(--danger) 0%,
        var(--warning) 50%,
        var(--success) 100%);
    background-size: 200% 100%;
    border-radius: 8px;
    transition: width 0.15s ease;
}

.hp-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 4px;
    display: block;
    text-align: right;
}

/* ===== Fighting Controls ===== */
.fighting-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 20;
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 18px 30px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-md);
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.control-btn .btn-icon {
    font-size: 1.8rem;
}

.control-btn .btn-label {
    font-size: 0.85rem;
}

.btn-reel {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-reel:active {
    background: var(--primary-dark);
    transform: scale(0.95);
}

.btn-hold {
    background: linear-gradient(135deg, var(--warning), #e68a00);
    color: white;
}

.btn-hold:active {
    background: #e68a00;
    transform: scale(0.95);
}

/* ===== Game Status Indicator ===== */
.game-status-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    color: white;
    text-align: center;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-status-indicator.show {
    opacity: 1;
}

.game-status-indicator.bite {
    color: var(--warning);
    animation: shake 0.3s ease-in-out infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(-50%); }
    25% { transform: translateX(calc(-50% - 8px)); }
    75% { transform: translateX(calc(-50% + 8px)); }
}

/* ===== Result Modal - Fish Display ===== */
.result-fish-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    margin: 20px 0;
}

.result-fish-display .fish-emoji {
    font-size: 5rem;
    animation: fishSwim 2s ease-in-out infinite;
}

@keyframes fishSwim {
    0%, 100% { transform: translateX(0) scaleX(1); }
    25% { transform: translateX(10px) scaleX(1); }
    50% { transform: translateX(0) scaleX(-1); }
    75% { transform: translateX(-10px) scaleX(-1); }
}

.result-fish-display .fish-details {
    text-align: center;
}

.result-fish-display .fish-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 5px;
}

.result-fish-display .fish-size {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.result-fish-display .fish-rarity {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Rarity Colors */
.fish-rarity.rare {
    color: #9b59b6;
}

.fish-rarity.epic {
    color: #e74c3c;
}

.fish-rarity.legendary {
    color: #f39c12;
    text-shadow: 0 0 10px rgba(243, 156, 18, 0.5);
}

.fish-rarity.mythic {
    color: #e91e63;
    text-shadow: 0 0 15px rgba(233, 30, 99, 0.6);
    animation: mythicGlow 1.5s ease-in-out infinite;
}

@keyframes mythicGlow {
    0%, 100% { text-shadow: 0 0 15px rgba(233, 30, 99, 0.6); }
    50% { text-shadow: 0 0 25px rgba(233, 30, 99, 0.9); }
}

/* ===== Result Fail State ===== */
.result-fish-display.fail {
    display: none;
}

#result-title.fail {
    color: var(--danger);
}

/* ===== Collection Modal ===== */
.collection-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px 0;
}

.collection-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.collection-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.collection-item.locked {
    opacity: 0.4;
    filter: grayscale(100%);
}

.collection-item .fish-icon {
    font-size: 2.5rem;
    margin-bottom: 5px;
}

.collection-item .fish-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

/* ===== Equipment Modal ===== */
.equipment-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.equipment-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.equipment-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.equipment-item.equipped {
    border: 2px solid var(--primary);
}

.equipment-item .equip-icon {
    font-size: 2rem;
}

.equipment-item .equip-info {
    flex: 1;
}

.equipment-item .equip-name {
    font-weight: 600;
    margin-bottom: 3px;
}

.equipment-item .equip-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== Tutorial Fishing-specific ===== */
.tutorial-step-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tutorial-step-item:last-child {
    border-bottom: none;
}

.tutorial-step-item .step-number {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.tutorial-step-item .step-content h3 {
    font-size: 1rem;
    margin-bottom: 5px;
}

.tutorial-step-item .step-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.tutorial-step-item .step-content strong {
    color: var(--accent);
}

/* ===== Locked Fishing Spots ===== */
.room-item.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.room-item.locked:hover {
    transform: none;
    box-shadow: none;
}

/* ===== Game Area Override ===== */
.game-room .game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    height: 100%;
}

/* ===== Table Container & Canvas ===== */
.table-container {
    position: relative;
    width: 100%;
    height: 80%;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #0a1628;
    border-radius: 8px;
}

/* Phaser가 생성하는 캔버스 */
.table-container canvas {
    display: block !important;
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
}

/* Phaser가 자체 캔버스를 생성하므로 #game-canvas 불필요 */

/* ===== Recent Catch List ===== */
#recent-catch .catch-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#recent-catch .catch-item:last-child {
    border-bottom: none;
}

#recent-catch .catch-emoji {
    font-size: 1.5rem;
}

#recent-catch .catch-info {
    flex: 1;
}

#recent-catch .catch-name {
    font-weight: 600;
    font-size: 0.9rem;
}

#recent-catch .catch-size {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .table-container {
        height: 70%;
        min-height: 250px;
    }

    .control-panel {
        bottom: 140px;
        width: 95%;
    }

    .fighting-controls {
        bottom: 80px;
    }

    .control-btn {
        padding: 15px 25px;
    }

    .control-btn .btn-icon {
        font-size: 1.5rem;
    }

    .location-info {
        position: static;
        transform: none;
    }
}

@media (max-width: 480px) {
    .control-btn {
        padding: 12px 20px;
    }

    .gauge-wrapper {
        padding: 8px 12px;
    }

    .power-bar,
    .tension-bar,
    .hp-bar {
        height: 14px;
    }
}

/* ===== Landscape Mode ===== */
@media (orientation: landscape) and (max-height: 500px) {
    .control-panel {
        bottom: 60px;
        flex-direction: row;
        max-width: 90%;
        gap: 15px;
    }

    .gauge-wrapper {
        flex: 1;
        padding: 6px 10px;
    }

    .fighting-controls {
        bottom: 10px;
    }

    .control-btn {
        padding: 10px 20px;
    }

    .control-btn .btn-icon {
        font-size: 1.3rem;
    }

    .control-btn .btn-label {
        font-size: 0.75rem;
    }
}
