/* styles.css - Updated with map editor controls styling and spectator functionality */

/* Core layout */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #121212;
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Navbar with subtle gradient */
.navbar {
    background: linear-gradient(to right, #1a1a2e, #252538);
    color: white;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    height: 40px;
    z-index: 100;
}

.navbar h1 {
    margin: 0;
    font-size: 20px;
    display: flex;
    align-items: center;
}

.navbar h1 i {
    margin-right: 8px;
    color: #4CAF50;
}

/* Updated navbar sections for better layout */
.navbar-left {
    flex: 1;
}

.navbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.navbar-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

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

#playerName {
    font-weight: bold;
    padding: 4px 8px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Role indicators for host and spectator status */
.role-indicator {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 5px;
    font-weight: bold;
}

.host-indicator {
    background-color: rgba(255, 193, 7, 0.2);
    color: #FFC107;
    border: 1px solid rgba(255, 193, 7, 0.4);
}

.spectator-indicator {
    background-color: rgba(158, 158, 158, 0.2);
    color: #9E9E9E;
    border: 1px solid rgba(158, 158, 158, 0.4);
}

/* Main container with optimal spacing */
.main-container {
    display: flex;
    flex: 1;
    padding: 8px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    gap: 8px;
}

/* Left sidebar with elegant collapsible sections */
.left-sidebar {
    width: 260px;
    background-color: #1e1e2d;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.collapsible-section {
    margin-bottom: 8px;
    border-radius: 4px;
    overflow: hidden;
    background-color: #252536;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 8px 10px;
    transition: background-color 0.2s;
}

.section-header:hover {
    background-color: #2c2c44;
}

.section-header h3 {
    margin: 0;
    font-size: 15px;
    display: flex;
    align-items: center;
}

.section-header h3 i {
    margin-right: 8px;
    font-size: 12px;
    opacity: 0.7;
}

.toggle-icon {
    transition: transform 0.3s ease;
    font-size: 12px;
    opacity: 0.7;
}

.toggle-icon.rotated {
    transform: rotate(180deg);
}

.section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 10px;
}

.section-content.expanded {
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
}

.room-info p {
    margin: 5px 0;
    font-size: 13px;
}

.room-info span {
    font-weight: bold;
}

/* Player list styling */
.player-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 4px;
    margin-bottom: 4px;
    background-color: rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s;
    position: relative;
    overflow: hidden;
}

.player-item:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

.player-item.current {
    background-color: rgba(76, 175, 80, 0.2);
    border-left: 3px solid #4CAF50;
}

/* Current turn styling with gradient */
.player-item.current-turn {
    position: relative;
    z-index: 1;
}

.player-item.current-turn::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 85%;
    background: linear-gradient(to left, rgba(255, 215, 0, 0.25), rgba(255, 215, 0, 0) 100%);
    z-index: -1;
    border-radius: 0 4px 4px 0;
    animation: pulse-subtle 2s infinite;
}

.turn-indicator {
    margin-left: auto;
    color: #FFD700;
    font-size: 14px;
    animation: pulse-subtle 2s infinite;
}

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

.player-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Spectator styling in player list */
.player-list-divider {
    margin-top: 10px;
    margin-bottom: 5px;
    padding: 5px;
    font-size: 12px;
    color: #aaa;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.player-item.spectator {
    opacity: 0.7;
    background-color: rgba(0, 0, 0, 0.05);
}

.player-item.spectator::before {
    content: "👁️";
    font-size: 10px;
    margin-right: 5px;
    opacity: 0.6;
}

.player-color {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.player-neutral {
    background-color: #888888;
}

.player1 {
    background-color: #2196F3;
}

.player2 {
    background-color: #4CAF50;
}

.player3 {
    background-color: #FFC107;
}

.player4 {
    background-color: #FF9A52;
}

/* Game controls with improved usability */
.game-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-top: 10px;
}

.game-status {
    margin-bottom: 10px;
    padding: 8px 10px;
    background-color: #252536;
    border-radius: 4px;
    border-left: 3px solid #4CAF50;
    max-height: 150px;
    overflow-y: auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.game-status p {
    margin: 5px 0;
    font-size: 13px;
}

/* Turn timer styles */
.turn-timer {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    margin: 5px 0;
    border-radius: 4px;
    font-weight: bold;
    font-size: 14px;
}

.turn-timer i {
    margin-right: 6px;
}

.timer-normal {
    background-color: rgba(33, 150, 243, 0.15);
    color: #2196F3;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.timer-warning {
    background-color: rgba(255, 152, 0, 0.15);
    color: #FF9800;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.timer-critical {
    background-color: rgba(244, 67, 54, 0.15);
    color: #F44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
    animation: pulse 1s infinite;
}

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

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.btn-small {
    font-size: 12px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: #2c3e50;
    transition: background-color 0.2s;
}

.btn-small:hover {
    background-color: #34495e;
}

/* Map editor with better layout */
.map-editor-controls {
    background-color: #252536;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    padding: 12px;
    margin-top: auto;
    overflow-y: auto;
    max-height: 200px;
}

.map-editor-controls h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 15px;
    display: flex;
    align-items: center;
}

.map-editor-controls h3 i {
    margin-right: 8px;
    font-size: 14px;
    color: #4CAF50;
}

/* Map size controls styling */
.map-size-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.map-size-buttons {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 15px;
}

.size-btn {
    flex: 1;
    padding: 10px 8px;
    background: linear-gradient(to bottom, #252540, #1e1e2d);
    border: 1px solid #3a3a68;
    border-radius: 6px;
    color: #e0e0e0;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.size-btn i {
    font-size: 16px;
    opacity: 0.8;
    transition: all 0.2s;
}

.size-btn:hover {
    background: linear-gradient(to bottom, #2a2a4a, #252536);
    border-color: #4a4a88;
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.size-btn.active {
    background: linear-gradient(to bottom, #3d6c3d, #2c5d2c);
    border-color: #4CAF50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
}

.size-btn.active i {
    color: #8bef8f;
    text-shadow: 0 0 5px rgba(76, 175, 80, 0.4);
    opacity: 1;
}

.map-size-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    margin: 0 5px;
    transition: all 0.2s ease;
}

.map-size-option:hover {
    background-color: rgba(76, 175, 80, 0.1);
}

.map-size-option input[type="radio"] {
    margin-bottom: 5px;
}

.map-size-option input[type="radio"]:checked+.map-size-label {
    color: #4CAF50;
    font-weight: bold;
}

.map-size-label {
    font-size: 14px;
}

.map-stats {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 15px;
    font-size: 13px;
}

.map-stats p {
    margin: 5px 0;
    display: flex;
    justify-content: space-between;
}

.control-group {
    margin-bottom: 8px;
}

.control-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    color: #aaaaaa;
}

.control-group input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: #1e1e2d;
    color: #e0e0e0;
    font-size: 13px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.control-group input:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
    outline: none;
}

/* Game area - maximize space and add depth */
.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    /* Allow flex shrinking */
}

.canvas-container {
    flex: 1;
    position: relative;
    background-color: #1e1e2d;
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #1a1a2a;
}

/* Add hover effect to canvas */
canvas:hover {
    cursor: crosshair;
}

/* Battle log with improved readability */
.battle-log {
    height: 125px;  /* Increased from 100px to 125px (25% taller) */
    background-color: #1e1e2d;
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.battle-log-header {
    padding: 6px 10px;
    background-color: #252536;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #333;
}

.battle-log-header h3 {
    margin: 0;
    font-size: 14px;
}

.battle-log-header i {
    margin-right: 8px;
    color: #FF5252;
    font-size: 12px;
}

/* Battle log navigation controls */
.battle-log-controls {
    display: flex;
    gap: 5px;
}

.log-scroll-btn {
    background: linear-gradient(to bottom, #2c2c44, #252536);
    border: 1px solid #3a3a68;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #e0e0e0;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.log-scroll-btn:hover {
    background: linear-gradient(to bottom, #36365a, #2c2c44);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    border-color: #4a4a88;
}

.log-scroll-btn:active {
    background: linear-gradient(to bottom, #3d6c3d, #2c5d2c);
    border-color: #4CAF50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
    color: #8bef8f;
    transform: translateY(0);
}

/* Style for disabled scroll buttons */
.log-scroll-btn.disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
    background: linear-gradient(to bottom, #252536, #1e1e2d);
    border: 1px solid #333;
    box-shadow: none;
}

#battleLogContent {
    flex: 1;
    overflow-y: auto;
    padding: 6px 10px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Hide scrollbar but maintain scroll functionality */
#battleLogContent.no-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;     /* Firefox */
}

#battleLogContent.no-scrollbar::-webkit-scrollbar {
    display: none;  /* Chrome, Safari and Opera */
}

.log-entry {
    margin-bottom: 6px;
    padding: 4px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
    line-height: 1.4;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.log-entry:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.log-time {
    color: #aaa;
    font-size: 10px;
    margin-right: 5px;
    font-weight: 400;
}

/* Battle outcome styling */
.log-entry.battle-win {
    background-color: rgba(76, 175, 80, 0.1);
    border-left: 3px solid #4CAF50;
    padding-left: 6px;
}

.log-entry.battle-lose {
    background-color: rgba(244, 67, 54, 0.1);
    border-left: 3px solid #f44336;
    padding-left: 6px;
}

.log-entry.battle-attack {
    background-color: rgba(255, 152, 0, 0.1);
    border-left: 3px solid #FF9800;
    padding-left: 6px;
}

.log-entry.battle-casualties {
    color: #bbb;
    font-style: italic;
    font-size: 11px;
    margin-top: -4px;
    border-top: none;
    background-color: rgba(0, 0, 0, 0.1);
    padding-left: 15px;
}

/* Region capture styling */
.log-entry.capture-success {
    background-color: rgba(33, 150, 243, 0.1);
    border-left: 3px solid #2196F3;
    padding-left: 6px;
}

/* Chain attack log entries */
.log-entry.chain-attack {
    background-color: rgba(255, 215, 0, 0.1);
    border-left: 3px solid #FFD700;
    padding-left: 6px;
}

/* Turn changes */
.log-entry.turn-change {
    background-color: rgba(156, 39, 176, 0.1);
    border-left: 3px solid #9C27B0;
    padding-left: 6px;
    font-weight: 500;
}

/* System messages */
.log-entry.system-message {
    background-color: rgba(33, 33, 33, 0.2);
    border-left: 3px solid #777;
    padding-left: 6px;
    color: #ccc;
}

/* Error messages */
.log-entry.error-message {
    background-color: rgba(244, 67, 54, 0.15);
    border-left: 3px solid #f44336;
    padding-left: 6px;
    color: #ff9e9e;
}

/* Important events */
.log-entry.important-event {
    font-weight: 500;
}

/* Player name colors in log */
.player-name {
    font-weight: 600;
    padding: 1px 3px;
    border-radius: 2px;
}

/* Region highlighting */
.region-highlight {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 1px 3px;
    border-radius: 2px;
    font-weight: 500;
}

/* Max troops indicator for battle log */
.log-entry.max-troops {
    background-color: rgba(255, 82, 82, 0.1);
    border-left: 2px solid #FF5252;
    padding-left: 5px;
}

/* Right sidebar - chat container */
.right-sidebar {
    width: 260px;
    background-color: #1e1e2d;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Region info container with fixed height */
.region-info-container {
    background-color: #1e1e2d;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    width: 100%;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
    height: 170px; /* Increased height to fit content without scrolling */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Default state when no region is hovered */
.region-info-default {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #888888;
    text-align: center;
    padding: 10px;
}

.region-info-default i {
    font-size: 24px;
    margin-bottom: 10px;
    opacity: 0.6;
}

/* Region info panel content */
.region-info {
    padding: 12px;
    font-size: 12px;
    transition: opacity 0.2s ease;
    opacity: 1;
}

.region-info h3 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

.region-info p {
    margin: 5px 0;
}

.region-info .attack-hint {
    font-weight: bold;
    color: #FF5252;
    margin-top: 5px;
}

.region-info .win-chance {
    display: inline-block;
    margin-top: 5px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
}

.win-chance {
    font-weight: bold;
}

.win-chance.high {
    background-color: rgba(76, 175, 80, 0.3);
    color: #66BB6A;
}

.win-chance.medium {
    background-color: rgba(255, 193, 7, 0.3);
    color: #FFC107;
}

.win-chance.low {
    background-color: rgba(244, 67, 54, 0.3);
    color: #EF5350;
}

/* Chain attack hint in the region info panel */
.chain-attack-hint {
    color: #FFD700;
    font-weight: bold;
    background-color: rgba(255, 215, 0, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    border-left: 3px solid #FFD700;
    animation: pulse-gold 2s infinite;
    margin: 5px 0;
}

/* Pulsing animation for the chain attack hint */
@keyframes pulse-gold {
    0% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.7;
    }
}

/* Max capacity indicator in region info */
.max-capacity {
    color: #FF5252;
    font-weight: bold;
    font-size: 0.9em;
}

/* Warning message for regions at max capacity */
.max-troops-warning {
    color: #FF5252;
    font-weight: bold;
    margin-bottom: 8px;
    padding: 2px 5px;
    background-color: rgba(255, 82, 82, 0.1);
    border-left: 3px solid #FF5252;
    border-radius: 2px;
    animation: pulse-warning 2s infinite;
}

/* Pulsing effect for regions at max capacity during distribute phase */
@keyframes pulse-warning {
    0% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.7;
    }
}

/* Chat container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 180px;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
}

.chat-header h3 {
    margin: 0;
    font-size: 15px;
}

.chat-header i {
    margin-right: 8px;
    color: #2196F3;
}

/* Chat options */
.chat-header-options {
    display: flex;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #aaa;
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    margin-right: 5px;
}

.toggle-text {
    white-space: nowrap;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 8px;
    padding: 8px;
    background-color: #252536;
    border-radius: 4px;
}

.chat-input {
    display: flex;
    background-color: #252536;
    border-radius: 4px;
    padding: 4px;
}

.chat-input input {
    flex: 1;
    padding: 8px;
    border: none;
    background-color: transparent;
    color: #e0e0e0;
    font-size: 13px;
}

.chat-input input:focus {
    outline: none;
}

.chat-input button {
    background: none;
    border: none;
    color: #4CAF50;
    padding: 0 8px;
    cursor: pointer;
    font-size: 14px;
    transition: color 0.2s;
}

.chat-input button:hover {
    color: #5CBA5C;
}

.chat-message {
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #333;
}

.chat-message .sender {
    font-weight: bold;
    margin-bottom: 2px;
    font-size: 12px;
    display: flex;
    align-items: center;
}

.chat-message .time {
    font-size: 10px;
    color: #aaa;
    margin-left: 5px;
}

.chat-message .content {
    word-break: break-word;
    font-size: 13px;
    padding-left: 18px;
}

.spectator-message {
    opacity: 0.85;
    background-color: rgba(0, 0, 0, 0.1);
    border-left: 2px solid #888;
    padding-left: 5px;
}

.spectator-tag {
    font-size: 10px;
    color: #888;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 2px 4px;
    border-radius: 3px;
    margin-left: 5px;
}

.spectator-icon {
    position: relative;
}

.spectator-icon::after {
    content: '\f06e';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    font-size: 8px;
    top: -2px;
    right: -2px;
    color: #888;
}

/* Improved buttons */
.btn {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: transform 0.5s, opacity 0.3s;
}

.btn:active::after {
    transform: translate(-50%, -50%) scale(2);
    opacity: 1;
    transition: 0s;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #4CAF50;
    color: white;
    box-shadow: 0 2px 5px rgba(76, 175, 80, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background-color: #3e8e41;
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
}

.btn-secondary {
    background-color: #2196F3;
    color: white;
    box-shadow: 0 2px 5px rgba(33, 150, 243, 0.3);
}

.btn-secondary:hover:not(:disabled) {
    background-color: #0b7dda;
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.4);
}

.btn-danger {
    background-color: #f44336;
    color: white;
    box-shadow: 0 2px 5px rgba(244, 67, 54, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background-color: #d32f2f;
    box-shadow: 0 4px 8px rgba(244, 67, 54, 0.4);
}

.btn-success {
    background-color: #4CAF50;
    color: white;
    box-shadow: 0 2px 5px rgba(76, 175, 80, 0.3);
    margin-right: 10px;
    transition: all 0.2s ease;
}

.btn-success:hover {
    background-color: #3e8e41;
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* Join as Player button in victory modal */
#joinAsPlayerBtn {
    background-color: #4CAF50;
    color: white;
    box-shadow: 0 2px 5px rgba(76, 175, 80, 0.3);
    margin-right: 10px;
    transition: all 0.2s ease;
}

#joinAsPlayerBtn:hover {
    background-color: #3e8e41;
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
    transform: translateY(-2px);
}

/* Add a subtle animation for the button appearance */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#joinAsPlayerBtn.visible {
    display: inline-flex !important;
    animation: fadeInScale 0.3s ease;
}

/* Generate map button styling */
#generateMapBtn {
    width: 100%;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#generateMapBtn i {
    margin-right: 8px;
}

/* Highlight pulse for the generate map button */
@keyframes highlight-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

.highlight-pulse {
    animation: highlight-pulse 1s infinite;
    border-color: #4CAF50 !important;
}

/* Modal styles with improved aesthetics */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}

.modal-content {
    background-color: #1e1e2d;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    width: 100%;
    transform: translateY(0);
    animation: modalAppear 0.3s ease;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #e0e0e0;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #f44336;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 13px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #444;
    border-radius: 4px;
    box-sizing: border-box;
    background-color: #252536;
    color: #e0e0e0;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
    outline: none;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

/* Victory modal styling */
.victory-modal .modal-body {
    text-align: center;
}

.victory-title {
    font-size: 24px;
    margin-bottom: 15px;
    color: gold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.winner-name {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.winner-name .player-color {
    margin-right: 10px;
    width: 15px;
    height: 15px;
}

/* Toast notifications with animations */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background-color: #1e1e2d;
    padding: 12px 15px;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
    transition: transform 0.3s, opacity 0.3s;
    transform: translateX(0);
    opacity: 1;
    max-width: 300px;
    font-size: 13px;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid #4CAF50;
}

.toast.error {
    border-left: 4px solid #f44336;
}

.toast.info {
    border-left: 4px solid #2196F3;
}

.toast.warning {
    border-left: 4px solid #FF9800;
}

.toast.chain-attack {
    border-left: 4px solid #FFD700;
    background-color: rgba(30, 30, 45, 0.95);
}

.toast.spectator-converted {
    border-left: 4px solid #4CAF50;
    background-color: rgba(76, 175, 80, 0.1);
}

.toast.hiding {
    transform: translateX(120%);
    opacity: 0;
}

/* Music player styling */
.music-player {
    display: flex;
    align-items: center;
    margin-left: 15px;
}

.music-toggle {
    background: none;
    border: none;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 16px;
    transition: color 0.2s;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.music-toggle:hover {
    color: #4CAF50;
    background-color: rgba(255, 255, 255, 0.1);
}

.music-controls {
    position: absolute;
    top: 50px;
    right: 15px;
    background-color: #1e1e2d;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 100;
    display: flex;
    gap: 8px;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.music-btn {
    background: none;
    border: none;
    color: #e0e0e0;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.music-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.volume-slider {
    -webkit-appearance: none;
    width: 80px;
    height: 5px;
    border-radius: 5px;
    background: #555;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
}

/* Loading indicator with smoother animation */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    background-color: rgba(30, 30, 45, 0.8);
    padding: 20px;
    border-radius: 8px;
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #4CAF50;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s cubic-bezier(0.6, 0.2, 0.4, 0.8) infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    transition: background-color 0.2s, transform 0.2s;
}

.sidebar-toggle:hover {
    background-color: #3e8e41;
    transform: scale(1.05);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

/* Mobile responsiveness */
@media (max-width: 1100px) {
    .main-container {
        flex-wrap: wrap;
        overflow-y: auto;
        height: calc(100vh - 56px);
    }

    /* Keep the three-section layout in medium screens */
    .navbar-left, 
    .navbar-center, 
    .navbar-right {
        flex: 1;
    }

    .left-sidebar,
    .right-sidebar {
        width: 48%;
        margin: 0 0 8px 0;
        height: auto;
        max-height: 300px;
    }

    .game-area {
        order: -1;
        width: 100%;
        height: calc(100vh - 370px);
        margin-bottom: 8px;
    }

    .battle-log {
        height: 80px;
    }

    /* Adjust region info for responsive layout */
    .region-info-container {
        height: 140px; /* Increased the responsive height as well */
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
        padding: 5px;
    }

    /* Adjust navbar for mobile */
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: 8px;
    }

    .navbar-left {
        width: 100%;
        margin-bottom: 5px;
        flex: none;
    }

    .navbar-center {
        width: 100%;
        order: 3;
        flex: none;
    }

    .navbar-right {
        order: 2;
        width: 100%;
        justify-content: flex-start;
        margin-bottom: 5px;
        flex: none;
    }

    .left-sidebar,
    .right-sidebar {
        width: 100%;
        max-height: 180px;
    }

    .game-area {
        height: calc(100vh - 400px);
    }

    .sidebar-toggle {
        display: block;
    }

    .left-sidebar,
    .right-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        z-index: 90;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        max-height: 70vh;
        border-radius: 15px 15px 0 0;
    }

    .left-sidebar.active,
    .right-sidebar.active {
        transform: translateY(0);
    }

    .sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px;
        border-bottom: 1px solid #333;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Styles for player list */
.player-item.disconnected {
    opacity: 0.8;
    border-left: 3px solid #ff5252;
    position: relative;
}

.disconnected-icon {
    margin-left: 5px;
    color: #ff5252;
    animation: pulse 2s infinite;
}

/* Eliminated player styling */
.player-item.eliminated {
    opacity: 0.5;
    filter: grayscale(100%);
    border-left: 3px solid #888;
    position: relative;
}

.eliminated-icon {
    margin-left: 5px;
    color: #888;
}

.host-indicator {
    font-weight: bold;
    color: #ffc107;
}

.current-indicator {
    font-weight: bold;
    color: #4caf50;
}

/* Enhance existing player-item styling */
.player-item {
    transition: all 0.3s ease;
}

.player-item.disconnected:hover {
    opacity: 0.9;
}

/* Add some animation for the disconnected icon */
@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

#spectatorJoinBtn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 15px;
    margin-top: 10px;
    margin-bottom: 10px;
    width: 100%;
    transition: background-color 0.3s ease;
    animation: pulse 2s infinite;
}

#spectatorJoinBtn:hover {
    background-color: #218838;
    animation: none;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* Remove old battle tools styling */
.tools-list {
    display: none;
}

.btn-tool {
    display: none;
}

.tool-description {
    display: none;
}

/* Character counter styling */
.char-counter {
    font-size: 0.75rem;
    margin-top: 2px;
    text-align: right;
    transition: color 0.3s, opacity 0.3s;
    opacity: 0.7;
}

/* Input styles for when limit is reached */
input.limit-reached,
textarea.limit-reached {
    border-color: #ff6b6b !important;
    background-color: rgba(255, 107, 107, 0.05) !important;
}

/* Show counter more prominently when limit is approached */
.char-counter.limit-approaching {
    color: orange;
    opacity: 1;
}

/* Style when limit is reached */
.char-counter.limit-reached {
    color: #ff6b6b;
    font-weight: bold;
    opacity: 1;
}

.alpha-tag {
    position: relative;
    font-size: 0.45em;
    font-weight: 600;
    color: #fff;
    background-color: #ff5722;
    padding: 3px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 5px;
    vertical-align: middle;
    top: -5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}

/* Expected losses indicators */
.attacker-losses {
    color: #e74c3c; /* Red for attacker losses */
    font-weight: bold;
}

.defender-losses {
    color: #3498db; /* Blue for defender losses */
    font-weight: bold;
}

/* Discord button in navbar */
.navbar-discord {
    background-color: #5865F2;
    color: white;
    margin-right: 10px;
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.navbar-discord:hover {
    background-color: #4752C4;
    transform: translateY(-2px);
}

.navbar-discord i {
    font-size: 16px;
}

/* Add styling for disabled regions */
.disabled-region {
    color: #e74c3c;
    font-weight: bold;
    padding: 5px;
    border-left: 3px solid #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
    margin: 5px 0;
}