/* ==========================================================================
   CLAN EVENTS & CONTROL POINT - CENTRALIZED STYLES
   Path: /clan-events/style.css
   ========================================================================== */

/* --- IMPORTS & FONTS --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Orbitron:wght@400;700;900&display=swap');

/* --- ROOT VARIABLES (Matched to Main Site) --- */
:root {
    /* Backgrounds */
    --primary-bg: #1e1e24;
    --secondary-bg: #232528;
    --tertiary-bg: #2c2f33;
    --interactive-bg: #36393f;
    --interactive-bg-hover: #4a4d52;

    /* Borders */
    --primary-border: #3a3d42;
    --interactive-border: #4f545c;

    /* Text */
    --primary-text: #e0e0e0;
    --secondary-text: #b9bbbe;
    --tertiary-text: #a0a0a0;
    --disabled-text: #7f8c8d;

    /* Accents */
    --accent-orange: #ff6f00;
    --accent-orange-hover: #ff8c42;
    --status-green: #2ecc71;
    --status-red: #e74c3c;
    --status-warning: #f1c40f;

    /* Spacing & Layout */
    --border-radius-sm: 5px;
    --border-radius-md: 8px;
    --border-radius-lg: 10px;
    --transition-speed: 0.2s;
    --shadow-lg: 0 8px 25px rgba(0,0,0,0.2);
}

/* ==========================================================================
   GLOBAL RESET & TYPOGRAPHY
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--primary-bg);
    color: var(--primary-text);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    /* Subtle grid pattern from main site */
    background-image:
        linear-gradient(rgba(45, 49, 56, 0.5) 1px, transparent 1px),
        linear-gradient(90deg, rgba(45, 49, 56, 0.5) 1px, transparent 1px);
    background-size: 35px 35px;
    overflow-x: hidden;
}

h1, h2, h3, h4, .brand-font {
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #fff;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ==========================================================================
   LAYOUT CONTAINERS
   ========================================================================== */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
}

/* --- Panels & Cards --- */
.card, .panel {
    background-color: var(--secondary-bg);
    border: 1px solid var(--primary-border);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.panel-header {
    border-bottom: 1px solid var(--primary-border);
    padding-bottom: 10px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    margin: 0;
    font-size: 1.1em;
    color: var(--accent-orange);
}

/* ==========================================================================
   UI COMPONENTS (Buttons, Inputs, Badges)
   ========================================================================== */

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: var(--accent-orange);
    color: #fff;
    border: 1px solid var(--accent-orange);
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    transition: all var(--transition-speed);
}

.btn:hover {
    background-color: var(--accent-orange-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(255, 111, 0, 0.2);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn.secondary {
    background-color: var(--tertiary-bg);
    border-color: var(--primary-border);
    color: var(--secondary-text);
}

.btn.secondary:hover {
    border-color: var(--primary-text);
    color: var(--primary-text);
    background-color: var(--interactive-bg);
}

.btn.danger {
    background-color: var(--status-red);
    border-color: var(--status-red);
}
.btn.danger:hover { background-color: #c0392b; }

/* --- Inputs --- */
input, select {
    width: 100%;
    padding: 10px 12px;
    background-color: var(--tertiary-bg);
    border: 1px solid var(--primary-border);
    color: var(--primary-text);
    border-radius: var(--border-radius-sm);
    font-family: 'Inter', sans-serif;
    transition: border-color var(--transition-speed);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 2px rgba(255, 111, 0, 0.2);
}

/* FIX: Prevent white background on autofill */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active{
    -webkit-box-shadow: 0 0 0 30px var(--tertiary-bg) inset !important;
    -webkit-text-fill-color: var(--primary-text) !important;
}

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    border: 1px solid transparent;
}
.badge.lobby { background: rgba(255, 111, 0, 0.15); color: var(--accent-orange); border-color: var(--accent-orange); }
.badge.active { background: rgba(46, 204, 113, 0.15); color: var(--status-green); border-color: var(--status-green); }

/* ==========================================================================
   HUB SPECIFIC STYLES (index.html)
   ========================================================================== */

/* --- Header Bar --- */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--secondary-bg);
    border-bottom: 1px solid var(--primary-border);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    border-radius: var(--border-radius-lg);
}

.user-badge {
    background: var(--tertiary-bg);
    padding: 8px 16px;
    border: 1px solid var(--primary-border);
    border-radius: var(--border-radius-sm);
    color: var(--accent-orange);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Lobby Grid --- */
.lobby-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.lobby-card {
    background-color: var(--tertiary-bg);
    border: 1px solid var(--primary-border);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    position: relative;
    transition: transform var(--transition-speed), border-color var(--transition-speed);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 200px;
}

.lobby-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-orange);
    box-shadow: var(--shadow-lg);
}

.lobby-card h3 {
    margin: 0 0 5px 0;
    font-size: 1.2em;
    color: #fff;
}

.lobby-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    color: var(--secondary-text);
    margin: 15px 0;
    padding: 10px 0;
    border-top: 1px solid var(--primary-border);
    border-bottom: 1px solid var(--primary-border);
}

/* --- Leaderboard Table --- */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.leaderboard-table th {
    text-align: left;
    color: var(--tertiary-text);
    padding: 10px 5px;
    border-bottom: 1px solid var(--primary-border);
    font-weight: 600;
    font-size: 0.8em;
    text-transform: uppercase;
}

.leaderboard-table td {
    padding: 12px 5px;
    border-bottom: 1px solid var(--interactive-bg);
    color: var(--secondary-text);
}

.leaderboard-table tr:last-child td { border-bottom: none; }
.leaderboard-table tr:hover td { color: var(--primary-text); background-color: rgba(255,255,255,0.02); }

/* Rank Colors */
.rank-1 { color: #ffd700 !important; font-weight: bold; }
.rank-2 { color: #c0c0c0 !important; font-weight: bold; }
.rank-3 { color: #cd7f32 !important; font-weight: bold; }

/* ==========================================================================
   GAME SPECIFIC STYLES (control-point/index.html)
   ========================================================================== */

/* --- Game Layout --- */
.game-container {
    display: grid;
    grid-template-rows: 60px 1fr;
    height: 100vh;
    overflow: hidden;
}

.game-header {
    background-color: var(--secondary-bg);
    border-bottom: 1px solid var(--primary-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    z-index: 10;
}

.game-main {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: 100%;
    overflow: hidden;
}

/* --- Sidebar Stats --- */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-box {
    background-color: var(--primary-bg);
    border: 1px solid var(--primary-border);
    border-radius: var(--border-radius-sm);
    padding: 10px;
    text-align: center;
}

.stat-val {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2em;
    font-weight: bold;
    color: #fff;
}

.stat-label {
    font-size: 0.7em;
    color: var(--tertiary-text);
    margin-top: 2px;
}

/* --- Game Board --- */
.board-area {
    background-color: #000;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    /* Dot Grid */
    background-image: radial-gradient(#333 1px, transparent 1px);
    background-size: 40px 40px;
}

.board-grid {
    display: grid;
    grid-template-columns: repeat(6, 100px);
    grid-template-rows: repeat(6, 100px);
    gap: 8px;
}

.tile {
    background-color: var(--secondary-bg);
    border: 2px solid var(--primary-border);
    border-radius: 4px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
}

.tile:hover {
    border-color: var(--accent-orange);
    transform: scale(1.05);
    z-index: 10;
    background-color: var(--interactive-bg);
}

.tile-name {
    font-size: 0.7em;
    font-weight: bold;
    color: var(--tertiary-text);
    text-align: center;
}

.tile-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.player-token {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.8);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* --- Overlays --- */
.lobby-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(30, 30, 36, 0.98);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.roster-card {
    width: 450px;
    background-color: var(--tertiary-bg);
    border: 1px solid var(--accent-orange);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.roster-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--primary-border);
    display: flex;
    justify-content: space-between;
    color: var(--primary-text);
}

/* ==========================================================================
   MODALS & UTILITIES
   ========================================================================== */
.modal-overlay{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(2px);
}

.modal{
  /* Updated for wider layout */
  width: min(1100px, 96vw);
  max-height: 95vh;
  background: #0b1220;
  border: 1px solid var(--primary-border);
  border-radius: 14px;
  padding: 25px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
}

/* Helper for 2-column modal layout */
.modal-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    overflow-y: auto;
    padding-right: 5px; /* space for scrollbar */
    margin-bottom: 20px;
}

/* On small screens, stack them again */
@media (max-width: 800px) {
    .modal-two-col {
        grid-template-columns: 1fr;
    }
}

.modal input,
.modal select{
  width: 100%;
  box-sizing: border-box;
}

.hidden { display: none !important; }

.error-banner {
    background-color: rgba(231, 76, 60, 0.1);
    border: 1px solid var(--status-red);
    color: var(--status-red);
    padding: 1rem;
    text-align: center;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1rem;
}

/* Log Container */
.log-container {
    background-color: #000;
    border: 1px solid var(--primary-border);
    padding: 10px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8em;
    color: var(--secondary-text);
    overflow-y: auto;
    flex-grow: 1;
    border-radius: 4px;
}
.log-entry { margin-bottom: 4px; border-bottom: 1px solid #111; padding-bottom: 2px; }