/* WCFHL Draft Tool — Dark theme matching dashboard */

:root {
    --bg: #0d1117;
    --bg2: #161b22;
    --bg3: #21262d;
    --bg4: #30363d;
    --fg: #c9d1d9;
    --fg2: #8b949e;
    --fg3: #484f58;
    --white: #f0f6fc;
    --accent: #4ecdc4;
    --blue: #58a6ff;
    --green: #3fb950;
    --yellow: #d29922;
    --orange: #db6d28;
    --red: #f85149;
    --purple: #bc8cff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Navigation */
.top-nav {
    background: var(--bg2);
    border-bottom: 1px solid var(--bg4);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

/* Padded pills, not bare text: the old 14px links were ~14px tall with no
   padding, which is well under a comfortable tap target and gave no hover
   affordance at all. */
.nav-links a {
    color: var(--fg2);
    text-decoration: none;
    font-size: 14px;
    padding: 9px 14px;
    border-radius: 6px;
    line-height: 1.2;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.nav-links a:hover { color: var(--white); background: var(--bg3); }

/* Where you are now. Without this every page's nav looks identical. */
.nav-links a.active {
    color: var(--white);
    background: var(--bg4);
    font-weight: 600;
    box-shadow: inset 0 -2px 0 var(--accent);
}

.nav-sep {
    width: 1px;
    height: 22px;
    background: var(--bg4);
    margin: 0 6px;
}

.nav-user { color: var(--fg2); font-size: 13px; padding: 0 8px; }
.nav-logout { color: var(--red) !important; }

/* ── GM hub tiles ────────────────────────────────────────────────────────
   The whole tile is the link, so the click target is the card, not a word
   inside it. */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.hub-card {
    display: block;
    background: var(--bg2);
    border: 1px solid var(--bg4);
    border-radius: 12px;
    padding: 22px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.hub-card:hover {
    border-color: var(--accent);
    background: var(--bg3);
    transform: translateY(-2px);
}

.hub-card:active { transform: translateY(0); }

.hub-icon { font-size: 30px; line-height: 1; margin-bottom: 12px; }
.hub-card h2 {
    font-size: 17px;
    margin: 0 0 6px;
    color: var(--white);
    border-bottom: none;
}
.hub-card p { color: var(--fg2); font-size: .88em; margin: 0; line-height: 1.45; }

.hub-card-admin { border-color: var(--accent); }

.hub-section-label {
    color: var(--fg2);
    font-size: .78em;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin: 4px 0 12px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--bg4);
    border-radius: 6px;
    background: var(--bg3);
    color: var(--fg);
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.btn:hover { background: var(--bg4); color: var(--white); }
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: #3db8b0; color: var(--bg); }
.btn-green { background: var(--green); color: var(--bg); border-color: var(--green); font-weight: 600; }
.btn-green:hover { background: #36a348; }
.btn-yellow { background: var(--yellow); color: var(--bg); border-color: var(--yellow); font-weight: 600; }
.btn-yellow:hover { background: #b8881e; }
.btn-red { background: var(--red); color: var(--bg); border-color: var(--red); font-weight: 600; }
.btn-red:hover { background: #d94540; }
.btn-secondary { background: var(--bg3); color: var(--fg); }
.btn-small { padding: 4px 10px; font-size: 12px; }
.btn-login {
    background: var(--accent);
    color: var(--bg) !important;
    border-color: var(--accent);
    font-weight: 600;
    padding: 6px 18px;
    border-radius: 6px;
}
.btn-login:hover { background: #3db8b0; color: var(--bg) !important; }

/* Cards */
.card {
    background: var(--bg2);
    border: 1px solid var(--bg4);
    border-radius: 8px;
    padding: 20px;
}

.card h2 {
    color: var(--accent);
    font-size: 1.1em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--bg4);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-green { background: var(--green); color: var(--bg); }
.badge-yellow { background: var(--yellow); color: var(--bg); }
.badge-red { background: var(--red); color: var(--bg); }
.badge-blue { background: var(--blue); color: var(--bg); }
.badge-purple { background: var(--purple); color: var(--bg); }
.badge-gray { background: var(--bg4); color: var(--fg2); }

.team-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--bg4);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    font-family: monospace;
}

.badge-traded { color: var(--yellow); }

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    color: var(--fg2);
    font-size: 13px;
    font-weight: 600;
}

input[type="text"], input[type="password"], input[type="number"],
input[type="file"], select, textarea {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--bg4);
    border-radius: 6px;
    color: var(--fg);
    font-size: 14px;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(78, 205, 196, 0.2);
}

/* Login */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 60px);
}

.login-card {
    background: var(--bg2);
    border: 1px solid var(--bg4);
    border-radius: 12px;
    padding: 32px;
    width: 400px;
    max-width: 100%;
}

.login-card h1 {
    text-align: center;
    color: var(--accent);
    margin-bottom: 24px;
}

.login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 8px;
    background: var(--bg3);
    border: 1px solid var(--bg4);
    border-radius: 6px;
    color: var(--fg2);
    cursor: pointer;
    font-size: 14px;
}

.tab-btn.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    font-weight: 600;
}

/* Alerts */
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-error { background: rgba(248, 81, 73, 0.15); color: var(--red); border: 1px solid var(--red); }
.alert-success { background: rgba(63, 185, 80, 0.15); color: var(--green); border: 1px solid var(--green); }

/* Draft header */
.draft-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.draft-header h1 { color: var(--white); }
.gm-subtitle { color: var(--fg2); }

/* On the Clock */
.on-the-clock {
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.15), rgba(88, 166, 255, 0.1));
    border: 2px solid var(--accent);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 24px;
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0%, 100% { border-color: var(--accent); }
    50% { border-color: rgba(78, 205, 196, 0.4); }
}

.on-the-clock.my-turn {
    border-color: var(--green);
    background: linear-gradient(135deg, rgba(63, 185, 80, 0.2), rgba(78, 205, 196, 0.1));
    animation: pulse-border-green 1.5s infinite;
}

@keyframes pulse-border-green {
    0%, 100% { border-color: var(--green); }
    50% { border-color: rgba(63, 185, 80, 0.4); }
}

.clock-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.clock-team {
    font-size: 28px;
    font-weight: 700;
    color: var(--white);
}

.clock-pick {
    font-size: 16px;
    color: var(--fg2);
    margin-top: 4px;
}

.clock-timer {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent);
    margin-top: 8px;
    font-family: monospace;
}

.clock-timer.warning { color: var(--yellow); }
.clock-timer.critical { color: var(--red); animation: blink 0.5s infinite; }

@keyframes blink {
    50% { opacity: 0.5; }
}

/* Draft Board Grid */
.draft-board {
    overflow-x: auto;
}

.draft-board table {
    width: 100%;
    border-collapse: collapse;
}

.draft-board th, .draft-board td {
    padding: 6px 10px;
    border: 1px solid var(--bg4);
    font-size: 12px;
    white-space: nowrap;
}

.draft-board th {
    background: var(--bg3);
    color: var(--fg2);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.draft-board .pick-cell {
    background: var(--bg2);
    min-width: 130px;
    transition: background 0.3s;
}

.draft-board .pick-cell.picked {
    background: var(--bg3);
}

.draft-board .pick-cell.current {
    background: rgba(78, 205, 196, 0.15);
    border-color: var(--accent);
}

.draft-board .pick-cell.just-picked {
    animation: flash-pick 1s ease-out;
}

@keyframes flash-pick {
    0% { background: rgba(78, 205, 196, 0.4); }
    100% { background: var(--bg3); }
}

.pick-cell .pick-num {
    color: var(--fg3);
    font-size: 10px;
}

.pick-cell .pick-team {
    color: var(--accent);
    font-weight: 700;
    font-size: 11px;
}

.pick-cell .pick-player {
    color: var(--white);
    font-weight: 600;
    font-size: 13px;
}

.pick-cell .pick-original {
    color: var(--yellow);
    font-size: 10px;
}

.pick-cell .pick-writein {
    color: var(--orange);
    font-size: 9px;
    font-style: italic;
}

/* Data tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg2);
    border-radius: 8px;
    overflow: hidden;
}

.data-table th, .data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--bg4);
    text-align: left;
    font-size: 13px;
}

.data-table th {
    background: var(--bg3);
    color: var(--fg2);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:hover { background: var(--bg3); }
.data-table tr.highlight { background: rgba(78, 205, 196, 0.1); }

/* Pick interface */
.pick-interface {
    background: var(--bg2);
    border: 1px solid var(--bg4);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.pick-interface h2 {
    color: var(--white);
    margin-bottom: 16px;
}

.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.search-bar input { flex: 2; }
.search-bar select { flex: 1; }

.pool-table-wrapper {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--bg4);
    border-radius: 6px;
    margin-bottom: 20px;
}

.write-in-section {
    border-top: 1px solid var(--bg4);
    padding-top: 16px;
}

.write-in-section h3 {
    color: var(--fg2);
    font-size: 14px;
    margin-bottom: 8px;
}

.write-in-form {
    display: flex;
    gap: 12px;
}

.write-in-form input { flex: 1; }

/* My picks list */
.my-picks {
    margin-bottom: 24px;
}

.my-picks h2 {
    color: var(--white);
    margin-bottom: 12px;
}

.picks-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pick-card {
    background: var(--bg2);
    border: 1px solid var(--bg4);
    border-radius: 8px;
    padding: 10px 14px;
    min-width: 200px;
}

.pick-card .pick-round { color: var(--fg3); font-size: 11px; }
.pick-card .pick-player-name { color: var(--white); font-weight: 600; }

/* Admin sections */
.admin-section {
    background: var(--bg2);
    border: 1px solid var(--bg4);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.admin-section h2 {
    color: var(--white);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--bg4);
}

.admin-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.control-group label {
    display: block;
    color: var(--fg2);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.control-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inline-form input, .inline-form select {
    width: auto;
    min-width: 120px;
}

small { color: var(--fg3); }

.pool-stats {
    color: var(--fg2);
    margin-bottom: 12px;
    font-size: 13px;
}

.admin-log {
    max-height: 300px;
    overflow-y: auto;
    font-size: 12px;
    font-family: monospace;
}

.log-entry {
    padding: 4px 8px;
    border-bottom: 1px solid var(--bg3);
    color: var(--fg2);
}

.log-entry .log-action { color: var(--accent); font-weight: 600; }
.log-entry .log-time { color: var(--fg3); }

/* Results table */
.results-table-wrapper {
    overflow-x: auto;
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg2);
    border: 1px solid var(--bg4);
    border-radius: 12px;
    padding: 24px;
    min-width: 350px;
    text-align: center;
}

.modal-content h3 {
    color: var(--white);
    margin-bottom: 12px;
}

.modal-content p { margin-bottom: 20px; }

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Responsive */
@media (max-width: 768px) {
    .top-nav {
        flex-direction: column;
        gap: 8px;
    }
    .nav-links { flex-wrap: wrap; justify-content: center; }
    .draft-header { flex-direction: column; align-items: flex-start; }
    .search-bar { flex-direction: column; }
    .inline-form { flex-wrap: wrap; }
    .control-row { flex-direction: column; }
    .clock-team { font-size: 22px; }
    .clock-timer { font-size: 28px; }
}

/* Round header in draft board */
.round-header {
    background: var(--bg3);
    color: var(--accent);
    font-weight: 700;
    font-size: 14px;
    padding: 8px 12px;
    text-align: center;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg3); }

#order-table-wrapper {
    max-height: 500px;
    overflow-y: auto;
}

#admin-pool-wrapper {
    max-height: 400px;
    overflow-y: auto;
}

/* ===== Lottery Styles ===== */

.lottery-results {
    margin-top: 16px;
}

.lottery-animation {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.lottery-winner-card {
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.15), rgba(63, 185, 80, 0.15));
    border: 2px solid var(--accent);
    border-radius: 8px;
    padding: 16px 24px;
    text-align: center;
    animation: lotteryReveal 0.6s ease-out;
}

.lottery-winner-label {
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.lottery-winner-team {
    color: var(--white);
    font-size: 28px;
    font-weight: 700;
}

.lottery-winner-name {
    color: var(--fg);
    font-size: 14px;
    margin-bottom: 4px;
}

.lottery-winner-odds {
    color: var(--fg2);
    font-size: 12px;
}

.lottery-row-animate {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.lottery-row-animate.visible {
    opacity: 1;
    transform: translateX(0);
}

tr.lottery-winner {
    background: rgba(78, 205, 196, 0.08);
}

tr.lottery-winner td {
    color: var(--accent);
}

@keyframes lotteryReveal {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== Home Page ===== */

.home-hero {
    text-align: center;
    padding: 48px 20px 32px;
}

.home-hero h1 {
    font-size: 36px;
    color: var(--white);
    margin-bottom: 4px;
}

.home-subtitle {
    font-size: 18px;
    color: var(--fg2);
    margin-bottom: 16px;
}

.home-status {
    margin-top: 8px;
}

.home-status .badge {
    font-size: 14px;
    padding: 4px 14px;
}

.home-nav-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

.home-card {
    background: var(--bg2);
    border: 1px solid var(--bg4);
    border-radius: 10px;
    padding: 28px 24px;
    text-decoration: none;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.home-card:hover {
    border-color: var(--fg3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.home-card-icon {
    font-size: 28px;
    margin-bottom: 8px;
    opacity: 0.7;
}

.home-card h2 {
    color: var(--white);
    font-size: 20px;
    margin-bottom: 8px;
}

.home-card p {
    color: var(--fg2);
    font-size: 14px;
    line-height: 1.5;
}

.home-card-accent {
    border-color: var(--accent);
}

.home-card-accent:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(78, 205, 196, 0.15);
}

.home-card-accent h2 {
    color: var(--accent);
}

.home-card-admin {
    border-color: var(--yellow);
}

.home-card-admin:hover {
    border-color: var(--yellow);
    box-shadow: 0 4px 16px rgba(210, 153, 34, 0.15);
}

.home-card-admin h2 {
    color: var(--yellow);
}

/* ===== Trade Tool ===== */

.trade-columns {
    display: flex;
    gap: 20px;
    margin-top: 12px;
}

.trade-column {
    flex: 1;
    background: var(--bg2);
    border: 1px solid var(--bg4);
    border-radius: 8px;
    padding: 16px;
}

.trade-column h3 {
    color: var(--accent);
    margin-bottom: 8px;
}

.trade-column select {
    width: 100%;
    padding: 8px;
    background: var(--bg3);
    color: var(--fg);
    border: 1px solid var(--bg4);
    border-radius: 6px;
    margin-bottom: 12px;
}

.asset-lists h4 {
    color: var(--fg2);
    font-size: 0.85em;
    margin: 10px 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.asset-scroll {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--bg4);
    border-radius: 4px;
    background: var(--bg);
    padding: 4px;
}

.asset-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.9em;
    gap: 6px;
}

.asset-item:hover {
    background: var(--bg3);
}

.asset-item input[type="checkbox"] {
    flex-shrink: 0;
}

.asset-item span:first-of-type {
    flex: 1;
}

.asset-meta {
    color: var(--fg3);
    font-size: 0.85em;
}

.trade-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
}

.trade-status {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.9em;
}

.status-success {
    background: rgba(63, 185, 80, 0.1);
    border: 1px solid var(--green);
    color: var(--green);
}

.status-error {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid var(--red);
    color: var(--red);
}

.trade-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.trade-card {
    background: var(--bg2);
    border: 1px solid var(--bg4);
    border-radius: 8px;
    padding: 14px;
}

.trade-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.trade-date {
    color: var(--fg2);
    font-size: 0.85em;
}

.trade-card-teams {
    font-weight: bold;
    color: var(--accent);
    font-size: 1.1em;
    margin-bottom: 6px;
}

.trade-card-detail {
    color: var(--fg);
    font-size: 0.9em;
    margin-bottom: 3px;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8em;
    margin-top: 8px;
}

.muted {
    color: var(--fg3);
    font-style: italic;
}

@media (max-width: 768px) {
    .trade-columns {
        flex-direction: column;
    }
}
