/* nfk/styles.css */

/* Общие стили для меню и форм */
body {
    margin: 0;
    padding: 2rem;
    height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1e1e2f, #2a2a4e);
    font-family: Arial, sans-serif;
    color: #ffffff;
    overflow: hidden;
}

.container {
    background: rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    text-align: center;
    width: 100%;
    max-width: 400px;
}

h1 { margin-bottom: 1.5rem; font-size: 2rem; text-shadow: 0 0 10px rgba(255, 255, 255, 0.5); }
input { display: block; box-sizing: border-box; width: 100%; padding: 0.8rem; margin: 0.5rem 0; border: none; border-radius: 5px; background: rgba(255, 255, 255, 0.2); color: #ffffff; font-size: 1rem; }
input::placeholder { color: rgba(255, 255, 255, 0.7); }
button { width: 100%; padding: 0.8rem; margin: 0.5rem 0; border: none; border-radius: 5px; background: #6200ea; color: #ffffff; font-size: 1rem; cursor: pointer; transition: background 0.3s; }
button:hover { background: #7f39fb; }
.error { color: #ff4d4d; margin-bottom: 1rem; }
.menu { display: flex; flex-direction: column; gap: 1rem; }
a { color: #bb86fc; text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- СТИЛИ ИСКЛЮЧИТЕЛЬНО ДЛЯ ИГРОВОГО ЭКРАНА --- */
body:has(.game-layout) {
    padding: 0;
    height: 100vh;
}

.page-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.game-layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
}

.game-column {
    display: flex;
    flex-direction: column;
}

#game-container {
    position: relative;
    width: 800px;
    height: 600px;
    background-color: #3e3e3e;
    border: 2px solid #555;
    border-top: none;
    box-sizing: border-box;
    overflow: hidden;
}

#game-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    background-color: transparent;
}

#gameCanvas { z-index: 10; }
#goreCanvas { z-index: 20; }
#aimLine    { z-index: 30; }

#ui {
    width: 800px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    color: white;
    text-shadow: 1px 1px 2px black;
    z-index: 50;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #555;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
}

#ui > div.ui-stat {
    background: rgba(0,0,0,0.4);
    padding: 5px 10px;
    border-radius: 4px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ui-stat::before {
    font-size: 1.1em;
    font-family: 'Arial';
    line-height: 1;
}
.icon-health::before { content: '❤️'; color: #ff4d4d; }
.icon-deaths::before { content: '💀'; }
.icon-kills::before { content: '🎯'; color: #ffc107; }
.icon-weapon::before { content: '🔫'; }
.icon-timer::before { content: '⏱️'; }
.icon-score::before { content: '🏆'; }

#ui button {
    width: auto;
    padding: 5px 15px;
    margin: 0;
    font-size: 0.9rem;
}
#ui #ready-button, #ui #start-game-button { margin-left: auto; }
#ui #exitButton { margin-left: 5px; }


#ready-button.ready {
    background-color: #00c853;
}
#ready-button.ready:hover {
    background-color: #00e676;
}

#player-list-container {
    width: 200px;
    height: calc(44px + 600px + 44px); /* ui + game + controls */
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    border: 2px solid #555;
    position: relative; /* Добавьте эту строку, чтобы z-index сработал */
    z-index: 50;      /* И эту строку, чтобы поднять список наверх */
}
#player-list-container h3 {
    text-align: center;
    margin-top: 0;
    border-bottom: 1px solid #555;
    padding-bottom: 10px;
}
#player-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

#player-list li {
    padding: 8px 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
}
#player-list li .player-name {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#player-list li .player-kills,
#player-list li .player-deaths {
    flex-basis: 25px;
    text-align: center;
    flex-shrink: 0;
}
#player-list li .player-status {
    flex-basis: 30px;
    text-align: center;
    font-size: 1.2em;
    flex-shrink: 0;
}
.player-list-header {
    font-weight: bold;
    color: #aaa;
}
.player-list-header .player-name {
    text-align: left;
}
.player-list-header .player-status {
    font-size: 0.9em;
}
#player-list li.current-player {
    background-color: rgba(187, 134, 252, 0.2);
    border-left: 3px solid #bb86fc;
}

.status-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    line-height: 1;
    text-align: center;
}
.status-ready-icon::before { content: '✓'; color: #00c853; }
.status-unready-icon::before { content: '✗'; color: #ffab00; }
.status-playing-icon::before { content: '▶'; color: #2979ff; font-size: 0.8em; }
.status-spectating-icon::before { content: '👁'; color: #9e9e9e; }
.remove-bot-btn { color: #ff4d4d; cursor: pointer; }


#pre-round-timer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: white;
    text-shadow: 2px 2px 10px black;
    z-index: 60;
    display: none;
}

.admin-container {
    width: 100%;
    max-width: 900px;
    height: 80vh;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}
.admin-header h1 {
    margin: 0;
}
.admin-header a {
    background: rgba(255,255,255,0.1);
    padding: 0.5rem 1rem;
    border-radius: 5px;
}

.admin-body {
    display: flex;
    flex-grow: 1;
    gap: 1.5rem;
    overflow: hidden;
}

.admin-nav {
    flex-basis: 200px;
    flex-shrink: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    padding-right: 1.5rem;
}
.admin-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.admin-nav .nav-link {
    display: block;
    padding: 0.8rem 1rem;
    border-radius: 5px;
    margin-bottom: 0.5rem;
    color: #ccc;
    transition: background 0.2s, color 0.2s;
}
.admin-nav .nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    text-decoration: none;
}
.admin-nav .nav-link.active {
    background: #6200ea;
    color: #fff;
    font-weight: bold;
}
.admin-content-wrapper {
    flex-grow: 1;
    overflow: hidden;
}
.admin-content {
    height: 100%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-right: 1rem;
}
.admin-content .tab-content {
    display: none;
}
.admin-content .tab-content.active {
    display: block;
}
.admin-content h2 {
    margin-top: 0;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    padding-bottom: 0.5rem;
}
.admin-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}
.admin-content label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.2rem 0;
    font-size: 1rem;
}
.admin-content input[type="number"],
.admin-content input[type="range"] {
    width: 120px;
    padding: 0.5rem;
    margin: 0;
}
.admin-content input[type="range"] {
    width: 200px;
}

.admin-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}
.admin-footer button {
    width: 100%;
}

.message {
    padding: 1rem;
    background: rgba(0, 200, 83, 0.3);
    border-radius: 5px;
    text-align: center;
    margin-bottom: 1rem;
}
.admin-button {
    background: #c51162;
}
.admin-button:hover {
    background: #d81b60;
}

.hint {
    font-size: 0.9rem;
    color: #ccc;
    margin-top: -0.5rem;
    margin-bottom: 2rem;
}
.sound-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}
.sound-name {
    flex-basis: 150px;
    font-weight: bold;
}
.sound-play-btn {
    width: auto;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    margin: 0 1rem;
    background: #444;
}
.sound-play-btn:hover {
    background: #555;
}
.sound-item input[type="file"] {
    width: auto;
    flex-grow: 1;
}
input[type="file"]::file-selector-button {
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 5px;
    background-color: #6200ea;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}
input[type="file"]::file-selector-button:hover {
    background-color: #7f39fb;
}

.playlist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
}
.delete-btn {
    width: auto;
    background: #c51162;
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
}

#game-blur-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    z-index: 40;
    pointer-events: none;
}

#game-blur-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.game-announcement {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 25px #6200ea;
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    text-align: center;
    white-space: nowrap;
}

.game-announcement.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

@keyframes roundPulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    30% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    80% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.2); opacity: 0; }
}

@keyframes matchEndPulse {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.game-announcement.active.round-animate {
    animation: roundPulse 4s forwards;
}
.game-announcement.active.match-end-animate {
    animation: matchEndPulse 3s forwards;
}

#game-over-announcement {
    font-size: 5rem;
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.8), 0 0 30px red;
    color: #ff4d4d;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.7);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
#game-over-announcement.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.end-round-countdown {
    position: absolute;
    top: 45%;
    left: 50%;
    font-size: 8rem;
    font-weight: bold;
    color: rgba(255, 82, 82, 0.7);
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.9);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(1.5);
}

@keyframes countdownPulse {
  0% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(0.95); }
  100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
}

.end-round-countdown.pulse {
    animation: countdownPulse 1s forwards ease-in-out;
}

#controls-container {
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    border-radius: 0 0 5px 5px;
    border: 2px solid #555;
    border-top: none;
    margin-top: -2px;
    box-sizing: border-box;
    width: 800px;
}
#controls-container .icon-button {
    font-size: 1.5rem;
}
.volume-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(30, 30, 47, 0.95);
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 100;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: opacity 0.3s, transform 0.3s;
}
.volume-panel.hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
    pointer-events: none;
}
.volume-panel h3 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 25px;
}
.slider-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}
.slider-group label {
    flex-basis: 120px;
}
.icon-button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #ccc;
    padding: 0 5px;
    user-select: none;
}
.icon-button:hover {
    color: white;
}
.mute-group {
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 15px;
}
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #555;
  transition: .4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
}
input:checked + .slider {
  background-color: #c51162;
}
input:checked + .slider:before {
  transform: translateX(26px);
}
.slider.round {
  border-radius: 34px;
}
.slider.round:before {
  border-radius: 50%;
}

.difficulty-selector {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #555;
}
.difficulty-selector h4 {
    text-align: center;
    margin: 0 0 10px 0;
    color: #ccc;
}
.difficulty-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}
.diff-btn {
    width: 100%;
    font-size: 0.8rem;
    padding: 5px;
    background: #444;
}
.diff-btn:hover {
    background: #555;
}
.diff-btn.active {
    background: #bb86fc;
    color: #1e1e2f;
    font-weight: bold;
}

/* --- СТИЛИ ДЛЯ ВЫБОРА СЛОЖНОСТИ И КНОПКИ УДАЛЕНИЯ --- */
.difficulty-selector {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #555;
}
.difficulty-selector h4 {
    text-align: center;
    margin: 0 0 10px 0;
    color: #ccc;
}
.difficulty-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}
.diff-btn {
    width: 100%;
    font-size: 0.8rem;
    padding: 5px;
    background: #444;
}
.diff-btn:hover {
    background: #555;
}
.diff-btn.active {
    background: #bb86fc;
    color: #1e1e2f;
    font-weight: bold;
}
.remove-bot-btn {
    color: #ff4d4d;
    cursor: pointer; /* Делаем крестик кликабельным на вид */
    font-weight: bold;
}

.remove-bot-btn.disabled {
    color: #666;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- ИСПРАВЛЕННЫЕ СТИЛИ ДЛЯ ЛОББИ --- */

.lobby-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.room-list-wrapper {
    flex-grow: 1;
}

.lobby-controls {
    flex-basis: 250px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.lobby-controls select,
.lobby-controls button {
    width: 100%;
    margin-bottom: 10px;
}

/* Кнопка выхода прижимается к низу */
.exit-menu-btn {
    margin-top: auto;
    background-color: #555;
}

#room-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    min-height: 300px;
    max-height: 40vh;
    overflow-y: auto;
    border: 1px solid rgba(0, 0, 0, 0.4);
}

#room-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
    transition: background-color 0.2s;
}

#room-list li:last-child {
    border-bottom: none;
}

#room-list li:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.join-btn {
    width: auto;
    padding: 0.4rem 0.8rem;
    margin: 0 0 0 1rem; /* отступ слева */
    font-size: 0.9rem;
}