/* ===================================
   CONSOLIDATED STYLE.CSS
   General Styles, Typography, Forms, and Base Elements
   =================================== */

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Varela Round', sans-serif;
}

/* Body and HTML */
html {
    height: 100%;
}

body {
    margin: 0;
    padding-top: 0px;
    font-family: Arial, sans-serif;
    font-size: 62.5%;
    background: url(images/stripe.png) repeat;
    text-align: center;
    padding-top: 30px;
    height: 100%;
}

/* Typography */
h1 { 
    font-size: 2.0em; 
    margin-bottom: 10px;
}

p { 
    font-size: 1.3em; 
    margin-bottom: 20px; 
}

/* Dynamic Viewport Height */
:root {
    --vh: 1vh;
}

/* ===================================
   PLAYER STATUS INDICATORS
   =================================== */

/* Player Status Styles */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.status-dot.status-online {
    background-color: #28a745;
}

.status-dot.status-offline {
    background-color: #6c757d;
}

/* ===================================
   ANIMATIONS AND KEYFRAMES
   =================================== */

/* Notification animations */
@keyframes slideInFade {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

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

/* Pulse animation for warnings */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* ===================================
   LOADING OVERLAY AND SPINNER
   =================================== */

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 2s linear infinite;
}

/* ===================================
   FLASH MESSAGES AND NOTIFICATIONS
   =================================== */

#flash-message {
    position: fixed !important;
    bottom: 10px !important;
    left: 5% !important;
    background-color: #ff4444 !important;
    color: white !important;
    padding: 10px 20px !important;
    border-radius: 5px !important;
    font-size: 12px !important;
    opacity: 0;
    transition: opacity 0.5s ease-in-out !important;
    z-index: 999999 !important;
    width: 90% !important;
    display: block !important;
}

.flash-message {
    position: fixed !important;
    bottom: 10px !important;
    left: 5% !important;
    background-color: #ff4444 !important;
    color: white !important;
    padding: 10px 20px !important;
    border-radius: 5px !important;
    font-size: 12px !important;
    opacity: 0;
    transition: opacity 0.5s ease-in-out !important;
    z-index: 999999 !important;
    width: 90% !important;
    display: block !important;
}

.flash-message.show {
    opacity: 1 !important;
    display: block !important;
}

.flash-message.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ===================================
   FORM ELEMENTS AND INPUTS
   =================================== */

.form-container {
    padding: 20px;
    background-color: transparent;
}

.form-container input,
.form-container textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
}

.form-container button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
}

.text-field-container {
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    padding: 5px;
    border-radius: 5px;
    max-width: 300px;
    margin-top: 10px;
}

#username_text, #invite_player_text {
    flex: 1;
    padding: 10px;
    border: none;
    outline: none;
    border-radius: 5px 0 0 5px;
}

#submit-button {
    background-color: #1b484e;
    color: #fff;
    border: none;
    border-radius: 0 5px 5px 0;
    padding: 10px 15px;
    cursor: pointer;
}

/* Input field improvements for mobile */
input[type="text"] {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px;
    margin: 8px 0;
}

/* ===================================
   AUTOCOMPLETE STYLING
   =================================== */

#autocomplete-results {
    min-height: 0;
    margin: 0;
    padding: 0;
    height: auto;
    display: none;
}

#autocomplete-results:empty {
    display: none !important;
    height: 0 !important;
}

#autocomplete-results:has(.ui-menu-item) {
    display: block !important;
}

#autocomplete-results .ui-menu {
    display: block !important;
    position: static !important;
    width: 100% !important;
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.ui-menu-item,
#autocomplete-results .ui-menu-item,
.ui-menu .ui-menu-item {
    padding: 10px 20px !important;
    margin: 5px 0 !important;
    background-color: #007BFF !important;
    color: white !important;
    border: none !important;
    border-bottom: 4px solid #0056b3 !important;
    cursor: pointer !important;
    text-align: center !important;
    max-width: 300px !important;
    transition: background-color 0.3s, border-bottom-color 0.3s !important;
}

.ui-menu-item:hover,
#autocomplete-results .ui-menu-item:hover,
.ui-menu .ui-menu-item:hover {
    background-color: #0056b3 !important;
    border-bottom-color: #004080 !important;
}

/* ===================================
   TABLES
   =================================== */

table {
    border-spacing: 1;
    border-collapse: collapse;
    background: #e3f2fd;
    border-radius: 6px;
    overflow: hidden;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    position: relative;
}

table * {
    position: relative;
}

table td, table th {
    padding-left: 8px;
    text-align: left;
}

table thead tr {
    height: 60px;
    background: #FFED86;
    font-size: 16px;
}

table tbody tr {
    height: 48px;
    border-bottom: 1px solid #E3F1D5;
    background-color: #e3f2fd;
}

table tbody tr:last-child {
    border: 0;
}

table td.l, table th.l {
    text-align: right;
}

table td.c, table th.c {
    text-align: center;
}

table td.r, table th.r {
    text-align: center;
}

/* ===================================
   CARD WARNING INDICATORS
   =================================== */

.card-warning {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 5px;
    font-weight: bold;
    text-transform: uppercase;
}

.card-warning.warning {
    background-color: #ff9500;
    color: white;
}

.card-warning.card {
    background-color: #ff3333;
    color: white;
    animation: pulse 1s infinite;
}

.mobile-warning {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 5px;
    font-weight: bold;
    text-transform: uppercase;
    float: right;
}

.mobile-warning.warning {
    background-color: #ff9500;
    color: white;
}

.mobile-warning.card {
    background-color: #ff3333;
    color: white;
    animation: pulse 1s infinite;
}

/* ===================================
   PLAYERS LIST AND MENU
   =================================== */

/* Default styles for the players menu */
.players_menu {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-x: scroll;
    max-width: 100%;
}

.players_menu li {
    display: inline-block;
    padding: 10px;
}

.players_menu li a {
    text-decoration: none;
    color: #000;
}

.mobile-toggle {
    display: none;
}

/* Mobile players styling */
.mobile-players {
    display: none;
}

.mobile-players-list {
    display: none;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-top: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: absolute;
    z-index: 1000;
    width: 100%;
}

.mobile-players-list.show {
    display: block;
}

.mobile-player {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.mobile-player:last-child {
    border-bottom: none;
}

.mobile-player.current {
    background-color: #e8f4fd;
    font-weight: bold;
    color: #1b484e;
}

/* Media query for mobile devices */
@media (max-width: 768px) {
    /* Hide the desktop players menu */
    .players_menu {
        display: none;
    }

    /* Show the mobile menu when the toggle button is clicked */
    .players_menu.show-mobile {
        display: block;
    }

    .players_menu li {
        display: block;
    }

    /* Styles for the mobile menu toggle button */
    .mobile-toggle {
        display: block;
        cursor: pointer;
        padding: 10px;
        background-color: #f0f0f0;
        border-radius: 5px;
        text-align: center;
        font-weight: bold;
    }
    
    .mobile-players {
        display: block;
        position: relative;
    }
}

/* ===================================
   UTILITY CLASSES
   =================================== */

.icon-image {
    max-width: 50%;
    padding-top: 10px;
}

.hide-game {
    background-color: grey;
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0px;
    top: 0px;
    z-index: 998;
    opacity: 0.7;
}

.showmenu {
    display: block;
}

/* ===================================
   STATUS TEXT
   =================================== */

.status-text {
    text-align: center;
    color: black;
    font-weight: 600;
    font-size: 14px;
    margin: 0 15px;
    white-space: nowrap;
    overflow: visible;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
}

/* Responsive status text */
@media screen and (max-width: 480px) {
    .status-text {
        font-size: 11px;
        margin: 0 2px;
    }
}

@media screen and (min-width: 481px) and (max-width: 667px) {
    .status-text {
        font-size: 13px;
        margin: 0 5px;
    }
}

@media screen and (min-width: 668px) and (max-width: 768px) {
    .status-text {
        font-size: 16px;
        font-weight: 600;
    }
}