/* WordBattle UI Improvements
 * Enhanced mana display, dialogs, and UI consistency
 */

/* ===========================
   ENHANCED MANA DISPLAY - FIXED
   =========================== */
.stat-bar {
    position: relative;
    height: 14px;
    max-width: 180px;
    background: linear-gradient(135deg, rgba(10, 10, 20, 0.9) 0%, rgba(20, 20, 40, 0.9) 100%);
    border: 1px solid rgba(100, 100, 150, 0.3);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    margin: 2px 0;
    border-radius: 7px;
}

.stat-fill {
    position: relative;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    border-radius: 6px;
}

.stat-fill.mana-fill {
    background: linear-gradient(90deg, 
        #0066cc 0%, 
        #0099ff 50%, 
        #00ccff 100%);
    box-shadow: 
        0 0 15px rgba(0, 150, 255, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Mana flow animation - disabled to fix scrolling issue */
/* Animation removed - was causing unwanted scrolling effect in top HUD */

.stat-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    font-weight: 600;
    font-size: 10px;
    text-shadow: 
        0 0 3px rgba(0, 0, 0, 1),
        0 1px 2px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.3px;
    white-space: nowrap;
    color: #fff;
    line-height: 14px;
}

/* External number display - disabled to fix overflow issues */
/* .stat-bar::before and .stat-bar::after removed to prevent HUD overflow */

/* Mana-specific styling - removed pseudo-elements to fix overflow */

/* Enhanced Mana Cost Display with Bar */
.mana-cost {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: linear-gradient(135deg, 
        rgba(20, 30, 50, 0.95) 0%, 
        rgba(30, 40, 70, 0.95) 100%);
    border: 2px solid rgba(0, 123, 255, 0.5);
    box-shadow: 
        0 4px 12px rgba(0, 123, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    padding: 12px 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    min-width: 280px;
    font-size: 14px;
    font-weight: 600;
}

/* Mana bar container in grammar panel */
.mana-cost-bar {
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(0, 123, 255, 0.3);
}

.mana-cost-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff 0%, #4a9eff 100%);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 9px;
}

.mana-cost-text {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    z-index: 1;
}

.mana-cost-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.mana-cost span {
    display: inline-block;
    margin: 0;
}

.mana-cost .cost-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mana-cost .cost-value {
    font-size: 18px;
    font-weight: bold;
    color: #ffd700;
}

.mana-cost .available-value {
    font-size: 18px;
    font-weight: bold;
    color: #00ccff;
}

.mana-cost .remaining-value {
    font-size: 16px;
    font-weight: bold;
    color: #00ff7f;
}

.mana-cost .shortage-value {
    font-size: 16px;
    font-weight: bold;
    color: #ff4444;
}

.mana-cost.insufficient {
    border-color: rgba(255, 0, 0, 0.5);
    background: linear-gradient(135deg, 
        rgba(50, 20, 20, 0.95) 0%, 
        rgba(70, 30, 30, 0.95) 100%);
    animation: insufficientShake 0.5s ease-in-out;
}

@keyframes insufficientShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ===========================
   ENHANCED DIALOGS
   =========================== */
.game-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: linear-gradient(135deg, 
        rgba(20, 20, 40, 0.98) 0%, 
        rgba(30, 30, 60, 0.98) 100%);
    border: 3px solid rgba(100, 100, 200, 0.5);
    border-radius: 20px;
    padding: 30px;
    min-width: 400px;
    max-width: 600px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.8),
        0 0 100px rgba(0, 123, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    animation: dialogEnter 0.3s ease-out;
}

@keyframes dialogEnter {
    from {
        opacity: 0;
        transform: translate(-50%, -45%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

.dialog-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(100, 100, 200, 0.3);
}

.dialog-title {
    font-size: 28px;
    font-weight: bold;
    background: linear-gradient(135deg, #fff, #ccc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.2);
    margin: 0;
}

.dialog-content {
    margin: 20px 0;
    color: var(--color-text-primary);
    font-size: 16px;
    line-height: 1.6;
}

.dialog-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.dialog-button {
    padding: 12px 30px;
    border: 2px solid;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.dialog-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.dialog-button:hover::before {
    width: 300px;
    height: 300px;
}

.dialog-button.primary {
    background: linear-gradient(135deg, var(--color-mana), var(--color-mana-light));
    border-color: var(--color-mana-light);
    color: white;
}

.dialog-button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 123, 255, 0.4);
}

.dialog-button.secondary {
    background: linear-gradient(135deg, 
        rgba(100, 100, 100, 0.3), 
        rgba(150, 150, 150, 0.2));
    border-color: rgba(200, 200, 200, 0.5);
    color: var(--color-text-primary);
}

.dialog-button.secondary:hover {
    background: linear-gradient(135deg, 
        rgba(120, 120, 120, 0.4), 
        rgba(170, 170, 170, 0.3));
    border-color: rgba(220, 220, 220, 0.6);
}

.dialog-button.danger {
    background: linear-gradient(135deg, var(--color-moral), var(--color-moral-light));
    border-color: var(--color-moral-light);
    color: white;
}

.dialog-button.danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(220, 53, 69, 0.4);
}

/* Confirmation Dialog */
.confirm-dialog {
    animation: confirmShake 0.3s ease-out;
}

@keyframes confirmShake {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    25% { transform: translate(-49%, -50%) rotate(-0.5deg); }
    75% { transform: translate(-51%, -50%) rotate(0.5deg); }
}

/* ===========================
   ENHANCED VICTORY SCREEN
   =========================== */
.victory-screen {
    background: radial-gradient(ellipse at center, 
        rgba(20, 20, 50, 0.95) 0%, 
        rgba(10, 10, 20, 0.98) 100%);
}

.victory-content {
    background: linear-gradient(135deg, 
        rgba(30, 30, 60, 0.98) 0%, 
        rgba(40, 40, 80, 0.98) 100%);
    border: 3px solid;
    border-image: linear-gradient(135deg, #ffd700, #ff6b7d, #4a9eff) 1;
    box-shadow: 
        0 30px 80px rgba(0, 0, 0, 0.8),
        0 0 150px rgba(255, 215, 0, 0.2);
    animation: victoryPulse 2s ease-in-out infinite;
}

@keyframes victoryPulse {
    0%, 100% { 
        box-shadow: 
            0 30px 80px rgba(0, 0, 0, 0.8),
            0 0 150px rgba(255, 215, 0, 0.2);
    }
    50% { 
        box-shadow: 
            0 30px 80px rgba(0, 0, 0, 0.8),
            0 0 200px rgba(255, 215, 0, 0.3);
    }
}

.victory-title {
    background: linear-gradient(135deg, 
        var(--color-path-light) 0%, 
        #fff 50%, 
        var(--color-path-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: victoryShine 3s linear infinite;
    background-size: 200% auto;
}

@keyframes victoryShine {
    to { background-position: 200% center; }
}

.defeat-title {
    background: linear-gradient(135deg, 
        var(--color-moral) 0%, 
        var(--color-moral-light) 50%, 
        var(--color-moral) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.victory-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

.victory-button {
    padding: 15px 40px;
    background: linear-gradient(135deg, 
        rgba(100, 100, 200, 0.3) 0%, 
        rgba(150, 150, 250, 0.2) 100%);
    border: 2px solid rgba(150, 150, 250, 0.5);
    border-radius: 15px;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
}

.victory-button::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        transparent, 
        rgba(255, 255, 255, 0.1), 
        transparent);
    transform: rotate(45deg);
    transition: all 0.5s;
}

.victory-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 40px rgba(100, 100, 255, 0.4);
    border-color: rgba(200, 200, 255, 0.8);
}

.victory-button:hover::after {
    animation: buttonShine 0.5s ease;
}

@keyframes buttonShine {
    0% { transform: rotate(45deg) translateX(-100%); }
    100% { transform: rotate(45deg) translateX(100%); }
}

/* ===========================
   GAME START DIALOG
   =========================== */
.game-start-dialog {
    max-width: 700px;
}

.game-mode-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.game-mode-option {
    padding: 20px;
    background: linear-gradient(135deg, 
        rgba(50, 50, 100, 0.3) 0%, 
        rgba(70, 70, 140, 0.2) 100%);
    border: 2px solid rgba(100, 100, 200, 0.4);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.game-mode-option:hover {
    transform: translateY(-3px);
    border-color: var(--color-mana-light);
    box-shadow: 0 10px 30px rgba(0, 123, 255, 0.3);
}

.game-mode-option.selected {
    background: linear-gradient(135deg, 
        rgba(0, 123, 255, 0.3) 0%, 
        rgba(74, 158, 255, 0.2) 100%);
    border-color: var(--color-mana);
    box-shadow: 
        0 5px 20px rgba(0, 123, 255, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.mode-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--color-text-primary);
    margin-bottom: 5px;
}

.mode-description {
    font-size: 12px;
    color: var(--color-text-secondary);
    line-height: 1.4;
}

/* ===========================
   IN-GAME NOTIFICATIONS
   =========================== */
.game-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    background: linear-gradient(135deg, 
        rgba(40, 40, 80, 0.98) 0%, 
        rgba(60, 60, 120, 0.98) 100%);
    border: 2px solid rgba(150, 150, 250, 0.5);
    border-radius: 15px;
    padding: 15px 30px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.8),
        0 0 60px rgba(100, 100, 255, 0.3);
    animation: notificationSlide 0.5s ease-out;
    backdrop-filter: blur(10px);
}

@keyframes notificationSlide {
    from {
        transform: translateX(-50%) translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.notification-icon {
    font-size: 24px;
    animation: notificationIcon 1s ease-in-out infinite;
}

@keyframes notificationIcon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.notification-text {
    font-size: 16px;
    color: var(--color-text-primary);
    font-weight: 600;
}

.notification.success {
    border-color: var(--color-will);
    background: linear-gradient(135deg, 
        rgba(32, 201, 151, 0.2) 0%, 
        rgba(110, 221, 185, 0.1) 100%);
}

.notification.error {
    border-color: var(--color-moral);
    background: linear-gradient(135deg, 
        rgba(220, 53, 69, 0.2) 0%, 
        rgba(255, 107, 125, 0.1) 100%);
}

.notification.warning {
    border-color: var(--color-honor);
    background: linear-gradient(135deg, 
        rgba(255, 193, 7, 0.2) 0%, 
        rgba(255, 213, 79, 0.1) 100%);
}

/* ===========================
   RESPONSIVE ADJUSTMENTS
   =========================== */
@media (max-width: 768px) {
    .game-dialog {
        min-width: 90%;
        max-width: 90%;
        padding: 20px;
    }
    
    .dialog-title {
        font-size: 24px;
    }
    
    .victory-content {
        padding: 20px;
        max-width: 90%;
    }
    
    .victory-title {
        font-size: 36px;
    }
    
    .game-mode-selection {
        grid-template-columns: 1fr;
    }
}