/* =========================================
   1. GLOBAL RESET & VARIABLES
   ========================================= */
* {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: #0b0e14; /* Deepest Dark Blue */
    color: white;
    height: 100vh;
    overflow: hidden; /* Prevent body scroll, handle inside app */
}

/* Scrollbar Styling */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #0b0e14; }
::-webkit-scrollbar-thumb { background: #2a3142; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #00ceb8; }

/* =========================================
   2. MAIN LAYOUT (RESPONSIVE)
   ========================================= */
.app-container {
    width: 100%;
    max-width: 1400px; /* WIDE DESKTOP WIDTH */
    margin: 0 auto;    /* Centers it on big screens */
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #0b0e14;
    border-left: 1px solid #181c25;
    border-right: 1px solid #181c25;
    position: relative;
}

/* Header Area */
#app-header {
    padding: 15px 20px;
    background: #181c25;
    border-bottom: 1px solid #2a3142;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#user-email {
    font-weight: 800;
    font-size: 18px;
    color: #fff;
    letter-spacing: 0.5px;
}

/* =========================================
   3. NAVIGATION TABS
   ========================================= */
.nav-tabs {
    display: flex;
    background: #181c25;
    border-bottom: 1px solid #2a3142;
}

.nav-tabs button {
    flex: 1;
    padding: 15px;
    background: transparent;
    color: #8899a6;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.nav-tabs button:hover {
    color: white;
    background: #1f2430;
}

.nav-tabs button.active {
    color: #00ceb8; /* Teal Highlight */
    border-bottom: 3px solid #00ceb8;
}

/* Content Area */
.tab-content {
    flex: 1;
    overflow: hidden; /* Important for inner scrolling */
    display: flex;
    flex-direction: column;
}

/* FORCE HIDE UTILITY */
.hidden { display: none !important; }

/* =========================================
   4. AUTH & SETUP SCREENS
   ========================================= */
#auth-section, #team-setup-section {
    padding: 40px;
    text-align: center;
    max-width: 400px;
    margin: 100px auto; /* Centers vertically/horizontally */
}

.logo-area {
    font-size: 60px;
    margin-bottom: 20px;
}

input {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    background: #181c25;
    border: 1px solid #2a3142;
    color: white;
    border-radius: 4px;
    font-size: 16px;
}

button {
    width: 100%;
    padding: 12px;
    background: #00ceb8;
    color: #0b0e14;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 10px;
}

button:hover { opacity: 0.9; }

.secondary-btn {
    background: transparent;
    border: 1px solid #00ceb8;
    color: #00ceb8;
}

/* =========================================
   5. CHAT TAB (Flexbox Layout)
   ========================================= */
#tab-chat {
    /* Handled by JS inline styles mostly, but defaults here */
    display: flex;
    flex-direction: column;
    height: 100%; 
}

#chat-window {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message-bubble {
    background: #181c25;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    border: 1px solid #2a3142;
    max-width: 80%;
}

.message-bubble strong {
    display: block;
    color: #00ceb8;
    font-size: 12px;
    margin-bottom: 4px;
}

.chat-input-area {
    padding: 20px;
    background: #181c25;
    border-top: 1px solid #2a3142;
    display: flex;
}

.chat-input-area button { width: auto; margin-bottom: 0; margin-left: 10px; }

/* =========================================
   6. DRAFT ROOM (GRID LAYOUT)
   ========================================= */
#tab-draft {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.search-bar-container {
    padding: 15px;
    background: #181c25;
    border-bottom: 1px solid #2a3142;
}

#player-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    
    /* GRID MAGIC: Responsive columns */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.player-card {
    background: #181c25;
    border: 1px solid #2a3142;
    padding: 15px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: transform 0.1s;
}

.player-card:hover {
    border-color: #00ceb8;
    background: #1f2430;
}

.player-info { flex: 1; }
.player-info h4 { margin: 0 0 5px 0; color: white; }
.player-info span { color: #8899a6; font-size: 12px; text-transform: uppercase; }

.draft-headshot {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 15px;
    border: 2px solid #2a3142;
    object-fit: cover;
}

.btn-draft {
    width: auto;
    padding: 5px 15px;
    font-size: 12px;
    margin: 0;
}

.btn-drop { background: #c0392b; color: white; }

/* =========================================
   7. ROSTER & DATA TABLES
   ========================================= */
#tab-roster, #tab-standings {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Container for table scroll */
#my-roster-list, #standings-table-container {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.roster-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 600px; /* Forces scroll on very small phones instead of breaking */
}

.roster-table th {
    background-color: #1f2430;
    color: #8899a6;
    text-transform: uppercase;
    font-size: 11px;
    padding: 12px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.roster-table th.text-left { text-align: left; padding-left: 20px; }

.roster-table td {
    padding: 10px;
    border-bottom: 1px solid #2a3142;
    color: #fff;
    text-align: center;
    background: #0b0e14;
}

/* Player Column Layout */
.roster-table td.player-cell {
    text-align: left;
    display: flex;
    align-items: center;
    padding-left: 20px;
}

.player-headshot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 15px;
    border: 2px solid #2a3142;
    object-fit: cover;
}

.player-text-wrapper {
    display: flex;
    flex-direction: column;
}

.player-sub {
    font-size: 11px;
    color: #8899a6;
    margin-top: 3px;
}

.slot-badge { color: #00ceb8; font-weight: bold; }
.table-header-row {
    background: #0b0e14;
    padding: 10px 20px;
    color: #00ceb8;
    font-weight: bold;
    font-size: 12px;
    border-bottom: 2px solid #2a3142;
    border-top: 1px solid #2a3142;
}

/* Dropdown styling */
.table-select {
    background: #181c25;
    color: #fff;
    border: 1px solid #4a5568;
    padding: 5px;
    border-radius: 4px;
    font-size: 11px;
}

/* =========================================
   8. MOBILE ADJUSTMENTS (Media Queries)
   ========================================= */
@media (max-width: 768px) {
    /* Mobile: Full Width */
    .app-container {
        max-width: 100%;
        border: none;
    }

    /* Mobile: Stack Draft Cards */
    #player-list {
        grid-template-columns: 1fr; /* 1 Column */
    }
    
    /* Mobile: Allow Table Horizontal Scroll */
    #my-roster-list {
        overflow-x: auto;
    }
    
    /* Mobile: Adjust Header */
    #app-header h3 { font-size: 16px; }
    
    /* Mobile: Smaller Tabs */
    .nav-tabs button { padding: 12px 5px; font-size: 12px; }
}
/* Commish Panel Styles */
.commish-panel {
    background: #181c25;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #2a3142;
}
.setting-row { margin-bottom: 10px; }
.setting-row label { display: inline-block; width: 150px; color:#8899a6; }
.setting-row input { width: 80px; padding: 5px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 15px; }
.btn-action { margin-top: 10px; width: 100%; }
/* --- DRAFT WAR ROOM --- */
#draft-ticker {
    background: #0b0e14;
    border-bottom: 2px solid #00ceb8;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.ticker-info { display: flex; flex-direction: column; }
#ticker-round { font-weight: bold; color: #fff; }
#ticker-clock { font-family: monospace; font-size: 20px; color: #e74c3c; font-weight: bold; }

.draft-split-container {
    display: flex;
    flex: 1;
    overflow: hidden; /* Lock scroll to inner elements */
}

.draft-main {
    flex: 2; /* Takes up 66% width on desktop */
    display: flex;
    flex-direction: column;
    border-right: 1px solid #2a3142;
}

.draft-sidebar {
    flex: 1; /* Takes up 33% width */
    display: flex;
    flex-direction: column;
    background: #11141b;
}

#draft-chat-window {
    flex: 1;
    overflow-y: scroll;
    padding: 15px;
}

/* ROSTER MODAL */
#roster-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 200;
    display: flex; justify-content: center; align-items: center;
}
.modal-content {
    background: #181c25;
    width: 90%; max-width: 500px;
    max-height: 80%;
    border-radius: 8px;
    padding: 20px;
    overflow-y: auto;
    border: 1px solid #444;
}

/* MOBILE ADJUSTMENT: Stack them */
@media (max-width: 768px) {
    .draft-split-container { flex-direction: column; }
    .draft-main { flex: 2; } /* Show players mostly */
    .draft-sidebar { flex: 1; border-top: 1px solid #00ceb8; max-height: 200px; }
}