/* =============================================
   Club de Ajedrez Monteolivete - Virtual Chess Club
   Main Stylesheet
   ============================================= */

/* CSS Variables - Matching server/public/styles.css color scheme */
:root {
    --primary: #4C6E51;
    --primary-dark: #3a5a3e;
    --primary-light: #5d8563;
    --secondary: #C4D7C8;
    --secondary-dark: #a8c4ae;
    --accent: #D4AF37;
    --accent-dark: #b8962e;
    --wood-dark: #8B4513;
    --wood-light: #A0522D;
    --light: #F5F5F5;
    --dark: #333333;
    --gray: #777777;
    --danger: #dc3545;
    --success: #28a745;
    --warning: #FFC107;
    --text-primary: #333333;
    --text-secondary: #777777;
    --text-light: #999;
    --border: #ddd;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-strong: rgba(0, 0, 0, 0.2);
    --overlay: rgba(0, 0, 0, 0.7);
    --font-display: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.2s ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--light);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--secondary);
    border-color: var(--text-light);
}

.btn-accent {
    background: var(--accent);
    color: var(--text-primary);
}

.btn-accent:hover:not(:disabled) {
    background: var(--accent-dark);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-large {
    padding: 14px 28px;
    font-size: 16px;
}

/* Form Elements */
input, select, textarea {
    font-family: var(--font-body);
    font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45, 90, 39, 0.1);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-light);
}

/* =============================================
   Authentication Pages (Login, Register, Pending)
   ============================================= */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.auth-header {
    text-align: center;
    padding: 30px 30px 20px;
    background: var(--secondary);
}

.club-emblem {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
}

.chess-icon {
    color: var(--primary);
}

.auth-header h1 {
    font-size: 22px;
    color: var(--primary);
    margin-bottom: 5px;
}

.auth-header .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 14px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--secondary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.auth-content {
    padding: 25px 30px;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.error-message {
    padding: 10px;
    margin-bottom: 15px;
    background: #fce4e4;
    color: var(--danger);
    border-radius: var(--radius);
    font-size: 13px;
    display: none;
}

.error-message:not(:empty) {
    display: block;
}

.register-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    margin-bottom: 15px;
    background: #fff3cd;
    border-radius: var(--radius);
    font-size: 13px;
    color: #856404;
}

.register-note svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.auth-footer {
    padding: 15px 30px;
    text-align: center;
    background: var(--secondary);
    border-top: 1px solid var(--border);
}

.auth-footer a {
    font-size: 13px;
}

/* Pending Page Specific */
.pending-card {
    max-width: 480px;
}

.pending-content,
.approved-content,
.rejected-content {
    padding: 30px;
    text-align: center;
}

.pending-icon,
.approved-icon,
.rejected-icon {
    margin-bottom: 20px;
}

.pending-icon svg { color: var(--accent); }
.approved-icon svg { color: var(--success); }
.rejected-icon svg { color: var(--danger); }

.pending-content h2,
.approved-content h2,
.rejected-content h2 {
    margin-bottom: 15px;
    font-size: 24px;
}

.pending-message,
.approved-message,
.rejected-message {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.pending-info {
    text-align: left;
    padding: 15px;
    background: var(--secondary);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
}

.info-value {
    font-weight: 500;
}

.pending-status {
    margin-top: 20px;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
}

.status-indicator .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-indicator.checking {
    background: #e3f2fd;
    color: #1976d2;
}

.status-indicator.checking .dot {
    background: #1976d2;
}

.status-indicator.pending {
    background: #fff3cd;
    color: #856404;
}

.status-indicator.pending .dot {
    background: var(--accent);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.rejection-reason {
    padding: 15px;
    background: #fce4e4;
    border-radius: var(--radius);
    text-align: left;
    margin-bottom: 20px;
}

/* =============================================
   Main Header
   ============================================= */

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: white;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.club-logo-small {
    width: 36px;
    height: 36px;
}

.chess-icon-small {
    color: var(--primary);
}

.main-header h1 {
    font-size: 18px;
    color: var(--primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.welcome-text {
    color: var(--text-secondary);
    font-size: 13px;
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    background: var(--accent);
    color: var(--text-primary);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.admin-badge.small {
    padding: 2px 6px;
    font-size: 10px;
}

.header-nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 8px 14px;
    border-radius: var(--radius);
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.nav-link:hover {
    color: var(--primary);
    background: var(--secondary);
}

.nav-link.active {
    color: var(--primary);
    background: rgba(45, 90, 39, 0.1);
}

/* =============================================
   Member Dashboard
   ============================================= */

.member-page {
    min-height: 100vh;
    background: var(--secondary);
}

.member-content {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.dashboard-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 15px var(--shadow);
    overflow: visible;
}

.dashboard-card .card-body {
    overflow: visible;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 16px;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
}

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.count-badge.alert {
    background: var(--danger);
}

/* Enter Club Card */
.card-enter {
    grid-column: span 1;
}

.enter-club-content {
    text-align: center;
}

.room-preview {
    margin-bottom: 20px;
}

.room-icon {
    max-width: 200px;
}

.online-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.online-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* Active Game Alert Card */
.card-alert {
    border: 2px solid var(--accent);
    background: linear-gradient(135deg, white 0%, #fffcf0 100%);
}

.card-alert .card-header {
    background: var(--accent);
    color: var(--text-primary);
}

.alert-badge {
    width: 24px;
    height: 24px;
    background: white;
    color: var(--accent-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.active-game-text {
    margin-bottom: 15px;
}

.active-game-info {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

/* Stats Card */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
    padding: 12px 6px;
    background: var(--secondary);
    border-radius: var(--radius);
    min-width: 0;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--primary);
}

.stat-item.stat-wins .stat-value { color: var(--success); }
.stat-item.stat-draws .stat-value { color: var(--accent); }
.stat-item.stat-losses .stat-value { color: var(--danger); }

.stat-label {
    font-size: 9px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.win-rate {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.win-rate-value {
    font-weight: 700;
}

.ratings-section h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.ratings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.rating-item {
    padding: 10px;
    background: var(--secondary);
    border-radius: var(--radius);
    text-align: center;
}

.rating-source {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.rating-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
}

/* Games List */
.games-list {
    max-height: 250px;
    overflow-y: auto;
}

.game-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition);
}

.game-row:hover {
    background: var(--secondary);
}

.game-row:last-child {
    border-bottom: none;
}

.game-players-mini {
    font-size: 13px;
}

.game-result-mini {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.result-win { background: #d4edda; color: #155724; }
.result-loss { background: #f8d7da; color: #721c24; }
.result-draw { background: #fff3cd; color: #856404; }

.game-date-mini {
    font-size: 11px;
    color: var(--text-light);
}

.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-light);
}

.empty-state-small {
    text-align: center;
    padding: 15px;
    color: var(--text-light);
    font-size: 13px;
}

.link-more {
    display: block;
    margin-top: 15px;
    text-align: center;
    font-size: 13px;
}

/* Members Preview */
.members-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.member-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--secondary);
    border-radius: 20px;
    font-size: 12px;
}

.member-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-light);
}

.member-dot.online {
    background: var(--success);
}

/* =============================================
   Admin Panel
   ============================================= */

.admin-page {
    min-height: 100vh;
    background: #f0ebe0;
}

.admin-header {
    background: var(--primary-dark);
}

.admin-header h1 {
    color: white;
}

.admin-header .welcome-text {
    color: rgba(255, 255, 255, 0.8);
}

.admin-header .nav-link {
    color: rgba(255, 255, 255, 0.8);
}

.admin-header .nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.admin-content {
    padding: 24px;
    max-width: 1600px;
    margin: 0 auto;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.admin-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 15px var(--shadow);
    overflow: hidden;
}

.admin-card.full-width {
    grid-column: 1 / -1;
}

.card-actions {
    display: flex;
    gap: 10px;
}

.search-input {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    width: 200px;
}

.filter-select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    background: white;
}

/* Admin Tables */
.admin-table-container {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    background: var(--secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.admin-table tbody tr:hover {
    background: var(--secondary);
}

.empty-row td {
    text-align: center;
    color: var(--text-light);
    padding: 30px;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.status-approved { background: #d4edda; color: #155724; }
.status-pending { background: #fff3cd; color: #856404; }
.status-suspended { background: #f8d7da; color: #721c24; }
.status-rejected { background: #e2e3e5; color: #383d41; }

.role-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.role-admin {
    background: var(--accent);
    color: var(--text-primary);
}

.role-user {
    background: var(--secondary);
    color: var(--text-secondary);
}

.action-btn {
    padding: 5px 10px;
    font-size: 12px;
    margin-right: 5px;
}

/* Admin Stats */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.admin-stat {
    text-align: center;
    padding: 15px;
    background: var(--secondary);
    border-radius: var(--radius);
}

.admin-stat-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--primary);
}

.admin-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.most-active h3 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.most-active-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.active-player-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--secondary);
    border-radius: var(--radius);
    font-size: 13px;
}

/* Admin Log */
.admin-log {
    max-height: 300px;
    overflow-y: auto;
}

.log-entry {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    color: var(--text-light);
    font-size: 11px;
}

.log-action {
    margin-top: 4px;
}

/* =============================================
   Club Page (3D Room)
   ============================================= */

.club-page {
    height: 100vh;
    overflow: hidden;
    background: #1a1a1a;
}

.club-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.club-title {
    font-family: var(--font-display);
    font-size: 16px;
    color: var(--accent);
}

.header-center {
    display: flex;
    align-items: center;
    gap: 10px;
}

.my-info {
    color: white;
    font-weight: 500;
}

.my-rating {
    color: var(--accent);
    font-size: 13px;
}

.header-btn {
    padding: 6px 14px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.header-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.header-btn.logout {
    color: #ff6b6b;
}

/* Game Container */
#game-container {
    position: fixed;
    top: 50px;
    left: 0;
    right: 280px;
    bottom: 0;
}

#club-canvas {
    width: 100%;
    height: 100%;
}

.interaction-prompt {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: var(--radius);
    font-size: 14px;
}

.interaction-prompt .key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: var(--text-primary);
    border-radius: 4px;
    font-weight: 700;
}

.controls-help {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.controls-help kbd {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    margin-right: 4px;
}

/* Sidebar */
.club-sidebar {
    position: fixed;
    top: 50px;
    right: 0;
    bottom: 0;
    width: 280px;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
    transition: transform var(--transition);
}

.club-sidebar.collapsed {
    transform: translateX(240px);
}

.sidebar-toggle {
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 60px;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-right: none;
    border-radius: 8px 0 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
}

.sidebar-toggle:hover {
    color: white;
}

.sidebar-section {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-section h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 12px;
}

.players-list,
.live-games-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    transition: background var(--transition);
}

.player-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.player-item.in-game {
    opacity: 0.7;
}

.player-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.player-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.player-dot.online {
    background: var(--success);
}

.player-dot.busy {
    background: var(--accent);
}

.player-name {
    color: white;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-rating {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    flex-shrink: 0;
}

.btn-challenge-small {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 4px 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.btn-challenge-small:hover {
    background: var(--primary-light);
    transform: scale(1.05);
}

.status-badge {
    font-size: 10px;
    color: var(--accent);
    background: rgba(212, 175, 55, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.player-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.player-status-dot.in-game {
    background: var(--accent);
}

.player-item-info {
    flex: 1;
}

.player-item-name {
    color: white;
    font-size: 13px;
    font-weight: 500;
}

.player-item-rating {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
}

.player-item-admin {
    color: var(--accent);
    font-size: 10px;
}

.live-game-item {
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition);
}

.live-game-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.live-game-players {
    color: white;
    font-size: 13px;
    margin-bottom: 5px;
}

.live-game-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

/* Dialogs */
.dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.dialog-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 25px;
    max-width: 400px;
    width: 90%;
    position: relative;
    text-align: center;
}

.dialog-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
}

.dialog-avatar {
    margin-bottom: 15px;
}

.dialog-avatar canvas {
    border-radius: var(--radius);
    background: var(--secondary);
}

.dialog-content h3 {
    margin-bottom: 10px;
}

.dialog-rating {
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.dialog-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

.dialog-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Challenge Dialog */
.dialog-challenge .challenge-icon {
    color: var(--accent);
    margin-bottom: 15px;
}

.challenger-rating {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.challenge-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Chess Overlay */
.chess-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
}

.chess-container {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    max-width: 900px;
    width: 95%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.chess-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: var(--primary);
    color: white;
}

.chess-player {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.player-name {
    font-weight: 500;
}

.player-rating {
    font-size: 12px;
    opacity: 0.8;
}

.game-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

#game-status-text {
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 13px;
}

.spectator-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 12px;
}

.spectator-badge.large {
    padding: 6px 12px;
    font-size: 13px;
}

.captured-pieces {
    font-size: 16px;
    letter-spacing: 2px;
}

.chess-main {
    display: flex;
    padding: 20px;
    gap: 20px;
}

.chess-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 480px;
    height: 480px;
    border: 3px solid var(--wood-dark);
    border-radius: 4px;
    overflow: hidden;
}

.chess-square {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition);
    position: relative;
    min-height: 0;
    min-width: 0;
}

.chess-square.light {
    background: var(--secondary);
}

.chess-square.dark {
    background: var(--primary);
}

.chess-square.selected {
    background: var(--accent) !important;
}

.chess-square.valid-move::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
}

.chess-square.valid-capture::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(0, 0, 0, 0.2);
    border-radius: 0;
    box-sizing: border-box;
}

.chess-square.last-move {
    background: rgba(212, 175, 55, 0.4) !important;
}

.chess-square.check {
    background: rgba(220, 53, 69, 0.5) !important;
}

.chess-sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.move-list-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.move-list-container h4 {
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.move-list {
    flex: 1;
    overflow-y: auto;
    background: var(--secondary);
    border-radius: var(--radius);
    padding: 10px;
    font-family: monospace;
    font-size: 13px;
    max-height: 300px;
}

.move-row {
    display: flex;
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
}

.move-number {
    width: 30px;
    color: var(--text-light);
}

.move-white,
.move-black {
    flex: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
}

.move-white:hover,
.move-black:hover {
    background: rgba(0, 0, 0, 0.1);
}

.move-current {
    background: var(--accent) !important;
    color: var(--text-primary);
}

.game-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Spectator Mode */
.spectator-mode .chess-container {
    pointer-events: auto;
}

.spectator-mode .chess-square {
    cursor: default;
}

.spectator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: #1a1a1a;
    color: white;
}

/* Game Result Dialog */
.dialog-result .result-icon {
    font-size: 64px;
    margin-bottom: 15px;
}

.dialog-result .result-icon.win { color: var(--success); }
.dialog-result .result-icon.loss { color: var(--danger); }
.dialog-result .result-icon.draw { color: var(--accent); }

.result-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* Disconnect Dialog */
.disconnect-icon {
    color: var(--text-light);
    margin-bottom: 15px;
}

.countdown {
    font-size: 36px;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--danger);
    margin: 20px 0;
}

.disconnect-note {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Mobile Tip - shows on first mobile visit */
.mobile-tip {
    display: none;
    position: fixed;
    bottom: 220px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.mobile-tip-content {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.mobile-tip-content .tip-icon {
    font-size: 24px;
}

.mobile-tip-content p {
    margin: 0;
    font-size: 14px;
    max-width: 180px;
}

.mobile-tip-content .btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

@media (max-width: 768px) {
    /* Hide desktop-only elements */
    .desktop-only {
        display: none !important;
    }

    /* Show mobile controls */
    .mobile-controls {
        display: flex !important;
    }

    /* Show mobile tip on first visit */
    .mobile-tip {
        display: flex;
    }

    /* Adjust sidebar for mobile */
    .club-sidebar {
        position: fixed;
        right: -280px;
        transition: right 0.3s ease;
        z-index: 100;
    }

    .club-sidebar.open {
        right: 0;
    }

    /* Full width canvas on mobile */
    #club-canvas {
        width: 100vw !important;
        height: calc(100vh - 50px) !important;
    }

    /* Smaller header on mobile */
    .club-header {
        padding: 8px 12px;
    }

    .club-header .header-right {
        gap: 5px;
    }

    .club-header .header-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* =============================================
   Games Archive Page
   ============================================= */

.games-page {
    min-height: 100vh;
    background: var(--secondary);
}

.games-content {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.games-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.games-table-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 15px var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
}

.games-table {
    width: 100%;
    border-collapse: collapse;
}

.games-table th,
.games-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.games-table th {
    background: var(--primary);
    color: white;
    font-weight: 500;
    font-size: 13px;
}

.games-table tbody tr:hover {
    background: var(--secondary);
}

.games-table .result-cell {
    font-weight: 600;
}

.loading-row td {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

#page-info {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Game Viewer (in modal) */
.modal-game {
    width: fit-content;
    max-width: 95vw;
    max-height: 95vh;
}

.modal-game .modal-body {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.game-viewer {
    display: flex;
    gap: 25px;
    min-height: 0;
    flex: 1;
}

.game-board-container {
    flex-shrink: 0;
}

.viewer-board {
    width: 450px;
    height: 450px;
}

.game-info-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 380px;
    flex-shrink: 0;
}

.game-players {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.game-players .player-info {
    text-align: center;
}

.game-players .player-info.white {
    color: var(--text-primary);
}

.game-players .player-info.black {
    color: var(--text-primary);
}

.game-result {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    font-weight: 700;
}

.game-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 13px;
    color: var(--text-secondary);
}

.game-info-panel .move-list {
    flex: 1;
    min-height: 120px;
    max-height: 250px;
    overflow-y: auto;
}

.viewer-controls {
    display: flex;
    gap: 8px;
    margin-top: auto;
    margin-bottom: 15px;
}

.viewer-actions {
    display: flex;
    gap: 10px;
}

/* =============================================
   Modals
   ============================================= */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-small {
    max-width: 400px;
}

.modal-content.modal-large {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Profile Modal */
.profile-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 30px;
}

.profile-avatar-section {
    text-align: center;
}

.profile-avatar-section h3,
.profile-info-section h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

#avatar-preview {
    background: var(--secondary);
    border-radius: var(--radius);
    margin-bottom: 15px;
}

.avatar-controls {
    text-align: left;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition);
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--text-primary);
}

.chess-accounts {
    margin-top: 20px;
}

.account-row {
    margin-bottom: 15px;
}

.account-row label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.account-input {
    display: flex;
    gap: 8px;
}

.account-input input {
    flex: 1;
}

.account-rating {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--primary);
}

/* Members Modal */
.members-search {
    margin-bottom: 15px;
}

.members-list {
    max-height: 400px;
    overflow-y: auto;
}

.member-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.member-list-item:last-child {
    border-bottom: none;
}

.member-list-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.member-list-name {
    font-weight: 500;
}

.member-list-rating {
    font-size: 13px;
    color: var(--text-secondary);
}

/* User Details in Admin */
.user-details {
    background: var(--secondary);
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.user-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.user-detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-secondary);
}

.detail-value {
    font-weight: 500;
}

.user-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* =============================================
   Toast Notifications
   ============================================= */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 4px 20px var(--shadow-strong);
    animation: slideIn 0.3s ease;
    max-width: 350px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.hiding {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 18px;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--primary); }

/* =============================================
   Responsive Adjustments
   ============================================= */

@media (max-width: 1200px) {
    .chess-board {
        width: 400px;
        height: 400px;
    }

    .chess-square {
        font-size: 32px;
    }
}

@media (max-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }

    .admin-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .profile-layout {
        grid-template-columns: 1fr;
    }

    /* Stats card - ensure 4 columns fit or use 2x2 */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .stat-item {
        padding: 12px 8px;
    }

    .stat-value {
        font-size: 22px;
    }

    .game-viewer {
        flex-direction: column;
        align-items: center;
    }

    .viewer-board {
        width: 100%;
        max-width: 380px;
        height: auto;
        aspect-ratio: 1;
    }

    .game-info-panel {
        width: 100%;
        max-width: 380px;
    }

    .game-info-panel .move-list {
        max-height: 150px;
    }

    .modal-game {
        width: 95vw;
        max-height: 98vh;
    }

    .modal-game .modal-body {
        overflow-y: auto;
    }
}

@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        gap: 10px;
        padding: 10px 15px;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .header-nav {
        display: none;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-item {
        padding: 10px 8px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-label {
        font-size: 10px;
    }

    .chess-main {
        flex-direction: column;
    }

    .chess-board {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
    }

    /* Game Viewer mobile adjustments */
    .modal-game {
        width: 98vw;
        max-width: 98vw;
        max-height: 95vh;
        margin: 10px;
    }

    .modal-game .modal-content {
        padding: 15px;
    }

    .viewer-board {
        width: 100%;
        max-width: 320px;
        height: auto;
        aspect-ratio: 1;
    }

    .game-info-panel {
        width: 100%;
        max-width: 320px;
    }

    .game-info-panel .move-list {
        max-height: 120px;
    }

    .viewer-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .game-players {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    .game-meta {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .auth-card {
        margin: 10px;
    }

    .auth-content {
        padding: 20px;
    }

    .btn-large {
        width: 100%;
    }

    /* Game Viewer small mobile */
    .modal-game {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .modal-game .modal-content {
        padding: 10px;
        border-radius: 0;
    }

    .viewer-board {
        width: 100%;
        max-width: 100%;
    }

    .game-info-panel {
        width: 100%;
        max-width: 100%;
    }

    .game-info-panel .move-list {
        max-height: 100px;
    }

    .game-players {
        font-size: 13px;
    }

    .game-meta {
        font-size: 11px;
    }

    .viewer-controls .btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* =============================================
   Mobile Joystick Controls
   ============================================= */

.mobile-controls {
    display: none; /* Hidden by default, shown on mobile */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    pointer-events: none;
    z-index: 50;
    padding: 20px;
    justify-content: space-between;
    align-items: flex-end;
}

.joystick-container {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.joystick-container.left {
    margin-left: 20px;
}

.joystick-container.right {
    margin-right: 20px;
}

.joystick-base {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.joystick-stick {
    width: 50px;
    height: 50px;
    background: linear-gradient(145deg, var(--primary-light), var(--primary));
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    position: absolute;
    transition: transform 0.05s ease-out;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.joystick-stick.active {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.joystick-label {
    font-size: 12px;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    font-weight: 500;
}

.mobile-interact-btn {
    pointer-events: auto;
    position: absolute;
    bottom: 80px;
    right: 160px;
    width: 70px;
    height: 70px;
    background: linear-gradient(145deg, var(--accent), var(--accent-dark));
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-family: var(--font-body);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.1s ease;
}

.mobile-interact-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.mobile-interact-btn span {
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
}

.mobile-interact-btn small {
    font-size: 9px;
    opacity: 0.9;
    margin-top: 2px;
}

/* Desktop: always show controls help, hide mobile joysticks */
@media (min-width: 769px) {
    .mobile-controls {
        display: none !important;
    }

    .desktop-only {
        display: flex !important;
    }
}

/* Touch optimization */
@media (hover: none) and (pointer: coarse) {
    .joystick-base {
        width: 130px;
        height: 130px;
    }

    .joystick-stick {
        width: 55px;
        height: 55px;
    }

    .mobile-interact-btn {
        width: 80px;
        height: 80px;
    }
}

/* =============================================
   Time Control Dialog & Chess Clocks
   ============================================= */

/* Time Control Dialog Content */
.time-control-content {
    max-width: 480px;
    width: 100%;
}

.time-control-content h3 {
    margin-bottom: 5px;
}

.time-control-content > p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Time Categories Grid */
.time-categories {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.time-category {
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--radius);
    padding: 12px;
}

.time-category h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.time-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.time-preset-btn {
    padding: 8px 14px;
    background: var(--secondary);
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
}

.time-preset-btn:hover {
    background: var(--secondary-dark);
}

.time-preset-btn.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary-dark);
}

/* Custom Time Section */
.custom-time-section {
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 20px;
}

.custom-time-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.custom-time-inputs {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.custom-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.custom-input-group label {
    font-size: 11px;
    color: var(--text-secondary);
}

.custom-input-group input {
    width: 70px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    text-align: center;
}

.custom-input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.custom-time-separator {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-secondary);
    padding-bottom: 8px;
}

/* Selected Time Display */
.selected-time-display {
    text-align: center;
    padding: 12px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.selected-time-display span {
    font-size: 13px;
    opacity: 0.9;
}

.selected-time-display strong {
    font-size: 18px;
    font-weight: 700;
}

/* Challenge Time Info (in challenge dialog) */
.challenge-time-info {
    background: rgba(76, 110, 81, 0.1);
    color: var(--primary);
    padding: 8px 15px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.challenge-time-info::before {
    content: "⏱️";
}

/* Chess Clocks */
.player-clock {
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius);
    font-family: 'Courier New', monospace;
    font-size: 20px;
    font-weight: 700;
    min-width: 85px;
    text-align: center;
    color: white;
    transition: all 0.3s ease;
}

.player-clock.active {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.player-clock.low-time {
    color: #FFC107;
    animation: clockPulse 1s infinite;
}

.player-clock.critical-time {
    color: var(--danger);
    background: rgba(220, 53, 69, 0.3);
    animation: clockPulse 0.5s infinite;
}

@keyframes clockPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Adjust chess player layout for clocks */
.chess-player.opponent {
    flex-direction: row;
}

.chess-player.self {
    flex-direction: row-reverse;
}

/* Mobile responsive for time control */
@media (max-width: 480px) {
    .time-categories {
        grid-template-columns: 1fr;
    }

    .custom-time-inputs {
        justify-content: center;
    }

    .player-clock {
        font-size: 16px;
        padding: 6px 10px;
        min-width: 70px;
    }
}

/* =============================================
   Online Players Module
   ============================================= */

/* Dashboard Online Players Card */
.card-online-players {
    grid-column: span 1;
}

.card-online-players .card-body {
    padding: 0;
}

/* Online Players Filters */
.online-players-filters {
    display: flex;
    gap: 10px;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    align-items: center;
}

.search-input-small {
    flex: 1;
    min-width: 120px;
    padding: 6px 10px;
    font-size: 13px;
}

.checkbox-small {
    font-size: 12px;
    white-space: nowrap;
}

/* Online Players List */
.online-players-list {
    max-height: 280px;
    overflow-y: auto;
}

.online-player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.online-player-item:last-child {
    border-bottom: none;
}

.online-player-item:hover {
    background: var(--secondary);
}

.online-player-item.in-game {
    opacity: 0.7;
}

.online-player-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.online-player-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.online-player-rating {
    font-size: 12px;
    color: var(--accent);
    white-space: nowrap;
}

.online-player-actions {
    flex-shrink: 0;
    margin-left: 10px;
}

.btn-challenge-player {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-challenge-player:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* Games Page Sidebar Layout */
.games-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    max-width: 1400px;
}

.games-sidebar {
    position: sticky;
    top: 24px;
    align-self: start;
}

.sidebar-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 15px var(--shadow);
    overflow: hidden;
}

.sidebar-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: var(--primary);
    color: white;
}

.sidebar-card-header h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.sidebar-card-body {
    padding: 0;
}

.games-main {
    min-width: 0;
}

/* Challenge target text (for dashboard pages) */
.challenge-target-text {
    text-align: center;
    margin-bottom: 20px;
    font-size: 15px;
}

/* Modal Small Size */
.modal-small {
    max-width: 420px;
}

/* Responsive for games sidebar */
@media (max-width: 900px) {
    .games-layout {
        grid-template-columns: 1fr;
    }

    .games-sidebar {
        position: static;
        order: -1;
    }

    .sidebar-card {
        max-height: none;
    }

    .online-players-list {
        max-height: 200px;
    }
}

/* Responsive for online players in member dashboard */
@media (max-width: 768px) {
    .card-online-players {
        grid-column: span 1;
    }

    .online-players-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input-small {
        width: 100%;
    }
}

/* =============================================
   Table Info Bubbles (3D Room)
   ============================================= */

.table-info-bubble {
    position: fixed;
    transform: translate(-50%, -100%);
    z-index: 50;
    pointer-events: none;
    animation: bubbleFadeIn 0.3s ease;
}

@keyframes bubbleFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -90%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -100%);
    }
}

.bubble-players {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.bubble-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 70px;
    padding: 6px 10px;
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.bubble-player.white {
    background: rgba(255, 255, 255, 0.1);
}

.bubble-player.black {
    background: rgba(0, 0, 0, 0.3);
}

.bubble-player.active {
    background: rgba(76, 110, 81, 0.4);
    box-shadow: 0 0 10px rgba(76, 110, 81, 0.5);
}

.bubble-name {
    font-size: 12px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.bubble-clock {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    min-width: 45px;
    text-align: center;
}

.bubble-player.active .bubble-clock {
    color: #7fff7f;
}

.bubble-clock.low-time {
    color: #FFC107;
    animation: clockPulse 1s infinite;
}

.bubble-clock.critical-time {
    color: var(--danger);
    animation: clockPulse 0.5s infinite;
}

.bubble-vs {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
}

/* Arrow pointing down from bubble */
.bubble-players::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid rgba(20, 20, 20, 0.95);
}

/* Spectator indicator */
.bubble-spectators {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.bubble-spectators::before {
    content: '👁';
    font-size: 10px;
}
