/* Make the chess board container position relative for absolute positioning of the watermark */
#board, #chessBoard {
  position: relative;
  /* Add some transparency to the board */
  opacity: 0.95; /* Adjust this value between 0 and 1 as needed */
  /* Ensure the board has proper dimensions */
  width: 100%;
  max-width: 600px; /* Adjust based on your desired board size */
  margin: 0 auto;
  /* Add a subtle shadow for depth */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  /* Ensure the board squares remain visible */
  background-color: transparent;
  /* Ensure the container has a defined height */
  height: auto;
  aspect-ratio: 1 / 1; /* Maintain square aspect ratio */
}

/* Create the watermark container */
#board::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%; /* Explicitly set width */
  height: 100%; /* Explicitly set height */
  /* Add your logo as a background image */
  background-image: url('logo.png'); /* Path to your Chessers logo */
  background-position: center center;
  background-repeat: no-repeat; /* Explicitly prevent repetition */
  background-size: 100%; /* Adjust size as needed */
  opacity: 0.25; /* Adjust watermark opacity */
  pointer-events: none; /* Ensures clicks pass through to the board */
  z-index: 1; /* Place between board and pieces */
}

/* Game Counter Styles */
.game-counter-container {
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 6px 12px;
    border-radius: 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    margin: 10px 0;
    font-family: 'Arial', sans-serif;
    max-width: fit-content;
}

.game-counter-label {
    font-size: 14px;
    margin-right: 8px;
    font-weight: 500;
    color: #f0f0f0;
}

.game-counter-value {
    font-size: 16px;
    font-weight: 700;
    color: #4CAF50;
    min-width: 40px;
    text-align: right;
}

/* Pulse animation for counter updates */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.game-counter-value.pulse {
    animation: pulse 0.5s ease-in-out;
}

.chess-user-panel-wrapper {
    position: relative;
    width: 300px;
    margin: 20px auto;
    font-family: Arial, sans-serif;
}

.chess-user-panel {
    background: #f5f5f5;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.panel-header {
    background: #4CAF50;
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.panel-header h3 {
    margin: 0;
    font-size: 16px;
}

.toggle-panel-btn {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.3s;
}

.panel-content {
    padding: 15px;
    max-height: 600px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.panel-collapsed .panel-content {
    max-height: 0;
    padding: 0 15px;
    overflow: hidden;
}

.panel-collapsed .toggle-panel-btn {
    transform: rotate(180deg);
}

.user-profile {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.user-profile h3 {
    margin: 0 0 5px 0;
    color: #333;
}

.rating {
    font-size: 18px;
    font-weight: bold;
    color: #4CAF50;
    margin-bottom: 10px;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logout-button {
    background: #f44336;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.logout-button:hover {
    background: #d32f2f;
}

.skills {
    margin-top: 15px;
}

.skill {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.skill label {
    width: 80px;
    font-size: 14px;
}

.skill-bar {
    flex-grow: 1;
    height: 8px;
    background: #ddd;
    border-radius: 4px;
    overflow: hidden;
    margin: 0 10px;
}

.skill-progress {
    height: 100%;
    background: #4CAF50;
}

.profile-actions {
    margin-top: 15px;
    text-align: center;
}

.profile-actions button {
    background: #2196F3;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
}

.profile-actions button:hover {
    background: #1976D2;
}

.auth-form {
    padding: 10px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.form-actions button {
    padding: 8px 15px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.form-actions button:hover {
    background: #45a049;
}

.toggle-form {
    margin-top: 15px;
    text-align: center;
}

.toggle-form a {
    color: #2196F3;
    text-decoration: none;
}

.toggle-form a:hover {
    text-decoration: underline;
}

.leaderboard {
    margin-top: 20px;
    border-top: 1px solid #ddd;
    padding-top: 15px;
}

.leaderboard h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.leaderboard-table th, .leaderboard-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.leaderboard-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.leaderboard-table tr:hover {
    background-color: #f5f5f5;
}

.leaderboard-table tr.current-user {
    background-color: #e8f5e9;
    font-weight: bold;
}

.leaderboard-loading {
    text-align: center;
    color: #666;
    padding: 10px;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background: #4CAF50;
    color: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.notification.error {
    background: #f44336;
}

.notification.show {
    transform: translateX(0);
}

.user-stats-link {
    cursor: pointer;
    color: #2196F3;
    text-decoration: underline;
}

.user-stats-link:hover {
    color: #0D47A1;
}

.profile-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.settings-button {
    background: #2196F3;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.settings-button:hover {
    background: #1976D2;
}

.logout-button {
    background: #f44336;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.logout-button:hover {
    background: #d32f2f;
}

.user-quote {
    font-style: italic;
    color: #666;
    margin: 15px 0 5px;
    padding: 10px;
    border-left: 3px solid #4CAF50;
    background-color: #f9f9f9;
    font-size: 14px;
    text-align: left;
}

/* Chess User Panel Styles */
.chess-user-panel-wrapper {
    margin-top: 20px;
}

.chess-user-panel {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.panel-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.2rem;
}

.toggle-panel-btn {
    background: none;
    border: none;
    color: #7f8c8d;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.3s;
}

.toggle-panel-btn.collapsed {
    transform: rotate(-90deg);
}

.panel-content {
    padding: 15px;
}

/* User Profile Styles */
#user-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.user-profile-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #3498db;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
}

.user-details {
    flex: 1;
}

.user-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 3px;
}

.user-rating {
    font-size: 1rem;
    color: #e67e22;
    font-weight: bold;
}

.user-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.stat-box {
    text-align: center;
    padding: 5px;
}

.stat-value {
    font-weight: bold;
    font-size: 1rem;
    color: #2c3e50;
}

.stat-label {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.user-skills {
    margin-top: 15px;
}

.skill-row {
    margin-bottom: 10px;
}

.skill-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.skill-name {
    font-size: 0.9rem;
    color: #34495e;
}

.skill-level {
    font-weight: bold;
    font-size: 0.9rem;
}

.skill-bar-container {
    height: 8px;
    background-color: #ecf0f1;
    border-radius: 4px;
    overflow: hidden;
}

.skill-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.skill-bar-fill.opening {
    background-color: #e74c3c;
}

.skill-bar-fill.middlegame {
    background-color: #f39c12;
}

.skill-bar-fill.endgame {
    background-color: #2ecc71;
}

.skill-bar-fill.tactics {
    background-color: #9b59b6;
}

.skill-bar-fill.strategy {
    background-color: #1abc9c;
}

.user-footer {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-size: 0.8rem;
    color: #95a5a6;
    display: flex;
    justify-content: space-between;
}

.user-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.user-action-btn {
    padding: 8px 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.user-action-btn:hover {
    background-color: #2980b9;
}

.user-action-btn.logout {
    background-color: #e74c3c;
}

.user-action-btn.logout:hover {
    background-color: #c0392b;
}
