@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --backdrop-image: url('images/backdrop.png');
}

body {
    font-family: 'Press Start 2P', monospace;
    background: var(--backdrop-image), linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: #ffffff;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--backdrop-image);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    filter: blur(3px);
    z-index: -1;
}

.main-content {
    flex: 1;
    padding: 1rem;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    color: #c018e5;
    text-shadow: 0 0 20px rgba(125, 216, 63, 0.5);
    letter-spacing: 1px;
}

.signup-deadline {
    color: #ffeb3b;
    text-align: center;
    font-size: 0.7rem;
    margin-bottom: 1rem;
    font-family: 'Press Start 2P', monospace;
}

.countdown-timer {
    display: inline-block;
    background: rgba(255, 235, 59, 0.2);
    border: 1px solid #ffeb3b;
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    font-weight: bold;
    color: #ffeb3b;
    text-shadow: 0 0 10px rgba(255, 235, 59, 0.5);
    cursor: help;
    transition: all 0.3s ease;
    position: relative;
}

.countdown-timer:hover {
    background: rgba(255, 235, 59, 0.3);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 235, 59, 0.4);
}

/* Custom tooltip */
.countdown-timer::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    pointer-events: none;
    z-index: 1000;
    margin-bottom: 5px;
    border: 1px solid #ffeb3b;
    font-family: 'Press Start 2P', monospace;
}

.countdown-timer::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #ffeb3b;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    pointer-events: none;
    z-index: 1000;
}

.countdown-timer:hover::after,
.countdown-timer:hover::before {
    opacity: 1;
    visibility: visible;
}

.subtitle {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 1rem;
}

.game-info {
    background: rgba(255, 107, 107, 0.1);
    border: 2px solid #ff6b6b;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 2rem;
    text-align: center;
}

.players-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 98%;
    background: #1a1a1a;
    border-radius: 15px;
    padding: 2rem;
    border: 2px solid #444;
}

.add-player-section {
    background: #2a2a2a;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

/* Special styling for dropdown in stat-item */
.stat-item select {
    margin: 0;
    font-size: 0.6rem;
    padding: 0.4rem 0.6rem;
    min-height: auto;
    align-self: center;
}

.stat-number {
    font-size: 0.9rem;
    font-weight: bold;
    color: #28a745;
    font-family: 'Press Start 2P', monospace;
    text-shadow: 0 0 5px rgba(40, 167, 69, 0.3);
}

.stat-number.eliminated {
    color: #dc3545;
    text-shadow: 0 0 5px rgba(220, 53, 69, 0.3);
}

.stat-label {
    font-size: 0.5rem;
    color: #999;
    font-family: 'Press Start 2P', monospace;
    text-transform: uppercase;
}

.add-player-form {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.add-player-form input {
    padding: 0.75rem 1rem;
    border: 2px solid #444;
    border-radius: 5px;
    background: #2a2a2a;
    color: white;
    font-size: 0.8rem;
    font-family: 'Press Start 2P', monospace;
    min-width: 200px;
}

.add-player-form input:focus {
    outline: none;
    border-color: #c018e5;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: 'Press Start 2P', monospace;
    font-weight: normal;
    transition: all 0.3s ease;
    position: relative;
}

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: auto; /* Allow hover events for tooltips */
    color: white !important; /* Keep text at full opacity */
}

.btn:disabled * {
    opacity: 1 !important; /* Ensure all child elements are at full opacity */
}

.btn:disabled:hover {
    transform: none; /* Prevent the hover lift effect when disabled */
}

/* Tooltip styles */
.btn[data-tooltip]:disabled::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #000000 !important;
    background-color: #000000 !important;
    color: #ffffff !important;
    padding: 0.5rem 0.75rem;
    border-radius: 5px;
    font-size: 0.6rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    border: 2px solid #c018e5 !important;
    z-index: 99999;
    box-shadow: 
        0 0 0 1px #000000,
        0 0 0 2px #000000,
        0 4px 12px rgba(0, 0, 0, 1) !important;
    backdrop-filter: none !important;
    filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.btn[data-tooltip]:disabled::before {
    content: '';
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #c018e5 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 10000;
}

.btn[data-tooltip]:disabled:hover::after,
.btn[data-tooltip]:disabled:hover::before {
    opacity: 1 !important;
    visibility: visible;
}

.btn-primary {
    background: #4a8c2a;
    color: white;
}

.btn-primary:hover {
    background: #3a7220;
    transform: translateY(-2px);
}

.btn-danger {
    background: #a71e2a;
    color: white;
}

.btn-danger:hover {
    background: #8b1a22;
}

.btn-info {
    background: #117a8b;
    color: white;
}

.btn-info:hover {
    background: #0e6674;
}

.player-list {
    display: grid;
    gap: 1.5rem;
}

.player-card {
    background: #2a2a2a;
    border-radius: 10px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.player-card:hover {
    border-color: #c018e5;
    transform: translateY(-2px);
}

.player-card.eliminated {
    opacity: 0.6;
    background: #4a2626;
    border-color: #dc3545;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.player-head {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    border: 2px solid #444;
    image-rendering: pixelated;
}

.player-details h3 {
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
    color: #ffffff;
}

.player-status {
    font-size: 1.0rem;
    color: #888;
}

.player-status.eliminated {
    color: #dc3545;
    font-weight: bold;
}

.lives-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lives-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    font-weight: bold;
}

.heart {
    color: #c018e5;
    font-size: 1.5rem;
}

.heart.empty {
    color: #444;
}

.lives-count {
    font-size: 1.6rem;
}

.lives-count.lives-3 {
    color: #28a745; /* Green for 3 lives */
}

.lives-count.lives-2 {
    color: #ffc107; /* Yellow for 2 lives */
}

.lives-count.lives-1 {
    color: #dc3545; /* Red for 1 life */
}

.elimination-timestamp {
    color: #dc3545;
    font-size: 0.8rem;
    font-weight: bold;
    text-align: center;
    min-width: 60px;
    display: inline-block;
    background: rgba(220, 53, 69, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background-color: #2a2a2a;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    text-align: center;
    border: 2px solid #c018e5;
}

/* Make specific modals taller */
#addPlayerModal .modal-content,
#taggedModal .modal-content {
    min-height: 400px;
    padding: 3rem 2rem;
}

/* Center input fields in modals */
.modal-content input[type="text"],
.modal-content input[type="password"] {
    display: block;
    margin: 0 auto 1rem auto;
    padding: 0.7rem 0.5rem;
    border-radius: 5px;
    border: 2px solid #444;
    background: #2a2a2a;
    color: white;
    width: 300px;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
}

/* Autocomplete container in modals */
.modal-content .autocomplete-container {
    width: 300px;
    margin: 0 auto 1rem auto;
}

.modal-content .autocomplete-container input {
    margin: 0;
    width: 100%;
}

.modal-content input[type="text"]:focus,
.modal-content input[type="password"]:focus {
    border-color: #c018e5;
    outline: none;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.admin-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(125, 216, 63, 0.2);
    border: 2px solid #c018e5;
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 5px;
    cursor: pointer;
    z-index: 9999;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.875rem;
}

.history-btn {
    position: absolute;
    top: 1rem;
    right: 8.75rem;
    background: rgba(23, 162, 184, 0.2);
    border: 2px solid #17a2b8;
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 5px;
    cursor: pointer;
    z-index: 9999;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.875rem;
    transition: right 0.3s ease;
}

.history-btn.admin-mode {
    right: 13.75rem;
}

.history-btn:hover {
    background: rgba(23, 162, 184, 0.4);
    transform: translateY(-1px);
}

.admin-panel {
    display: none;
    background: rgba(125, 216, 63, 0.1);
    border: 2px solid #c018e5;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.admin-panel.active {
    display: block;
}

.admin-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.btn-success {
    background: #28a745;
    color: white;
    padding: 0.4rem 0.8rem;
    font-size: 0.7rem;
    font-family: 'Press Start 2P', monospace;
    min-width: 80px;
    text-align: center;
}

.btn-success:hover {
    background: #218838;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
    padding: 0.4rem 0.8rem;
    font-size: 0.7rem;
    font-family: 'Press Start 2P', monospace;
    min-width: 80px;
    text-align: center;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    padding: 0.4rem 0.8rem;
    font-size: 0.7rem;
    font-family: 'Press Start 2P', monospace;
    min-width: 80px;
    text-align: center;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-yellow {
    background: #ffc107;
    color: white;
}

.btn-yellow:hover {
    background: #e0a800;
}

/* Ensure all admin control buttons have consistent sizing */
.admin-controls .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.7rem;
    min-width: 80px;
    text-align: center;
    white-space: nowrap;
}

/* Override for info and danger buttons in admin controls */
.admin-controls .btn-info {
    padding: 0.4rem 0.8rem;
    font-size: 0.7rem;
    min-width: 80px;
    text-align: center;
}

.admin-controls .btn-danger {
    padding: 0.4rem 0.8rem;
    font-size: 0.7rem;
    min-width: 80px;
    text-align: center;
}

/* Rules modal specific styling */
#rulesContent {
    text-align: left;
    line-height: 1.6;
    color: #ffffff;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-bottom: 1rem;
}

/* Custom scrollbar for rules content */
#rulesContent::-webkit-scrollbar {
    width: 8px;
}

#rulesContent::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 4px;
}

#rulesContent::-webkit-scrollbar-thumb {
    background: #c018e5;
    border-radius: 4px;
}

#rulesContent::-webkit-scrollbar-thumb:hover {
    background: #6bc82b;
}

/* Custom scrollbar for history content */
#historyContent::-webkit-scrollbar {
    width: 8px;
}

#historyContent::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 4px;
}

#historyContent::-webkit-scrollbar-thumb {
    background: #c018e5;
    border-radius: 4px;
}

#historyContent::-webkit-scrollbar-thumb:hover {
    background: #6bc82b;
}

/* Custom scrollbar for logs content */
#logsContent::-webkit-scrollbar {
    width: 8px;
}

#logsContent::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 4px;
}

#logsContent::-webkit-scrollbar-thumb {
    background: #c018e5;
    border-radius: 4px;
}

#logsContent::-webkit-scrollbar-thumb:hover {
    background: #6bc82b;
}

/* Custom scrollbar for eliminations content */
#eliminationsContent::-webkit-scrollbar {
    width: 8px;
}

#eliminationsContent::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 4px;
}

#eliminationsContent::-webkit-scrollbar-thumb {
    background: #c018e5;
    border-radius: 4px;
}

#eliminationsContent::-webkit-scrollbar-thumb:hover {
    background: #6bc82b;
}

#rulesContent h1 {
    color: #c018e5;
    font-size: 1.4rem;
    margin-bottom: 1rem;
    text-align: center;
}

#rulesContent h2 {
    color: #c018e5;
    font-size: 1.0rem;
    margin: 1.5rem 0 0.8rem 0;
}

#rulesContent h3 {
    color: #ffc107;
    font-size: 0.9rem;
    margin: 1rem 0 0.5rem 0;
}

#rulesContent p {
    margin-bottom: 0.8rem;
    font-size: 0.7rem;
}

#rulesContent ul {
    margin: 0.5rem 0 1rem 1rem;
}

#rulesContent li {
    margin-bottom: 0.3rem;
    font-size: 0.7rem;
}

#rulesContent strong {
    color: #c018e5;
}

#rulesContent code {
    background: rgba(125, 216, 63, 0.2);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.5rem;
}

#rulesContent hr {
    border: none;
    border-top: 2px solid #c018e5;
    margin: 1.5rem 0;
}

.disclaimer {
    margin-top: auto;
    padding: 0.8rem 0;
    text-align: center;
    color: #888;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6rem;
    border-top: 1px solid #444;
    background: #1a1a1a;
    width: 100%;
    flex-shrink: 0;
}

.disclaimer p {
    margin: 0.2rem 0;
    padding: 0.3rem 0;
}

.disclaimer a {
    color: #17a2b8;
    text-decoration: none;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6rem;
}

.disclaimer a:hover {
    color: #138496;
    text-decoration: underline;
}

.close {
    font-family: Arial, sans-serif !important;
}

/* Loading States - Easy to remove by setting ENABLE_LOADING_STATES to false */
.loading-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #888;
    font-size: 0.7rem;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-spinner::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid #444;
    border-top: 2px solid #7dd83f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.background-loading::before {
    filter: blur(5px);
    transition: filter 0.3s ease;
}

.error-state {
    color: #dc3545;
    text-align: center;
    padding: 2rem;
    font-size: 0.7rem;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid #dc3545;
    border-radius: 8px;
    margin: 1rem 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

/* Sort section styling */
.sort-section {
    margin: 1rem 0;
    padding: 0.5rem;
}

.sort-section label {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    color: #ccc;
}

.sort-section select {
    background: #2d2d2d;
    color: #fff;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6rem;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.sort-section select:hover {
    border-color: #7dd83f;
}

.sort-section select:focus {
    outline: none;
    border-color: #7dd83f;
    box-shadow: 0 0 0 2px rgba(125, 216, 63, 0.2);
}

/* Autocomplete dropdown styling */
.autocomplete-container {
    position: relative;
    display: block;
    margin-bottom: 1rem;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #2d2d2d;
    border: 1px solid #444;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.autocomplete-item {
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    border-bottom: 1px solid #444;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s ease;
}

.autocomplete-item:hover {
    background-color: #3d3d3d;
}

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

.autocomplete-item img {
    width: 24px;
    height: 24px;
    border-radius: 2px;
}

.autocomplete-item.no-results {
    color: #888;
    cursor: default;
    text-align: center;
}

.autocomplete-item.no-results:hover {
    background-color: #2d2d2d;
}
