/* AI Poker Frontend Styles */

:root {
    /* Colors */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --bg-card: #161e2e;
    --bg-hover: #1e293b;

    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --accent-primary: #10b981;
    --accent-secondary: #3b82f6;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;

    --border-color: #374151;
    --border-focus: #10b981;

    /* Table colors */
    --table-felt: #0d542a;
    --table-felt-dark: #0a3d1f;
    --table-border: #8b5a2b;

    /* Spacing */
    --header-height: 70px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.3);
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 32px;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-badge {
    background: var(--accent-danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    animation: blink 1.5s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 8px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.tab-icon {
    font-size: 18px;
}

/* Header Stats */
.header-stats {
    display: flex;
    gap: 24px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Main Content */
.main-content {
    margin-top: var(--header-height);
    padding: 24px;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #059669);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

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

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

/* Rooms Grid */
.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.room-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.room-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.room-card.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    cursor: default;
}

.room-card.empty-state:hover {
    transform: none;
    border-color: var(--border-color);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.room-name {
    font-weight: 600;
    font-size: 16px;
}

.room-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.room-status.waiting {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-warning);
}

.room-status.playing {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-primary);
}

.room-players {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.player-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 13px;
}

.player-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.room-info {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 13px;
}

/* Poker Table */
.poker-table {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.table-felt {
    background: linear-gradient(135deg, var(--table-felt) 0%, var(--table-felt-dark) 100%);
    border: 8px solid var(--table-border);
    border-radius: 200px;
    padding: 80px 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    box-shadow:
        inset 0 0 50px rgba(0, 0, 0, 0.3),
        0 10px 40px rgba(0, 0, 0, 0.5);
}

.community-cards {
    display: flex;
    gap: 10px;
}

.card {
    width: 60px;
    height: 84px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.card.hearts,
.card.diamonds {
    color: #ef4444;
}

.card.clubs,
.card.spades {
    color: #1f2937;
}

.card.hidden {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: transparent;
}

.card.hidden::before {
    content: '🂠';
    font-size: 40px;
}

.pot-display {
    text-align: center;
}

.pot-label {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
}

.pot-amount {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-warning);
}

.pot-amount::before {
    content: '$';
}

/* Table Seats */
.table-seats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
}

.seat {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    min-width: 140px;
    text-align: center;
}

.seat.active {
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.seat.folded {
    opacity: 0.5;
}

.seat-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
    border-radius: 50%;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.seat-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.seat-chips {
    color: var(--accent-warning);
    font-size: 13px;
}

.seat-cards {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 8px;
}

.seat-cards .card {
    width: 36px;
    height: 50px;
    font-size: 14px;
}

/* Game Log */
.game-log {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-top: 20px;
    max-height: 200px;
    overflow: hidden;
}

.log-header {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
}

.log-entries {
    padding: 12px 16px;
    max-height: 160px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.log-entry {
    padding: 4px 0;
    color: var(--text-secondary);
}

.log-entry .action {
    color: var(--accent-primary);
}

/* Skill Editor */
.skill-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.editor-wrapper {
    height: 600px;
}

#skill-editor {
    width: 100%;
    height: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
}

#skill-editor:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.editor-actions {
    display: flex;
    gap: 12px;
}

.skill-preview {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    height: 500px;
    overflow-y: auto;
}

.agent-status {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
}

.status-icon {
    font-size: 24px;
    margin-right: 8px;
}

/* Leaderboard */
.leaderboard-table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
}

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

.leaderboard-table th,
.leaderboard-table td {
    padding: 16px 20px;
    text-align: left;
}

.leaderboard-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.leaderboard-table tr:not(:last-child) td {
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-table tr:hover td {
    background: var(--bg-hover);
}

.rank-cell {
    font-weight: 700;
    font-size: 18px;
}

.rank-cell.gold {
    color: #fbbf24;
}

.rank-cell.silver {
    color: #9ca3af;
}

.rank-cell.bronze {
    color: #cd7f32;
}

.agent-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.balance-cell {
    color: var(--accent-warning);
    font-weight: 600;
}

.winrate-cell {
    color: var(--accent-primary);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.status-badge.online {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-primary);
}

.status-badge.offline {
    background: rgba(107, 114, 128, 0.2);
    color: var(--text-muted);
}

.leaderboard-empty {
    text-align: center;
    padding: 60px;
    color: var(--text-secondary);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-color: var(--accent-primary);
}

.toast.error {
    border-color: var(--accent-danger);
}

.toast.warning {
    border-color: var(--accent-warning);
}

/* Responsive */
@media (max-width: 1024px) {
    .skill-container {
        grid-template-columns: 1fr;
    }

    .header-stats {
        display: none;
    }
}

@media (max-width: 768px) {
    .nav-tabs {
        display: none;
    }

    .logo-text {
        font-size: 18px;
    }
}

/* Live Game Styles */
.live-indicator {
    color: #ef4444;
    font-size: 12px;
    animation: blink 1s infinite;
    margin-left: 8px;
}

.round-indicator {
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    color: var(--accent-warning);
    margin-bottom: 10px;
}

/* Card Colors */
.card.red {
    color: #ef4444;
}

.card.black {
    color: #1f2937;
}

.card.small {
    width: 36px;
    height: 50px;
    font-size: 12px;
}

/* Seat Bet */
.seat-bet {
    background: var(--accent-warning);
    color: black;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 4px;
}

.folded-text {
    color: var(--text-muted);
    font-size: 11px;
    font-style: italic;
}

/* Action Log Colors */
.action-fold {
    color: #6b7280;
}

.action-check {
    color: #10b981;
}

.action-call {
    color: #3b82f6;
}

.action-raise {
    color: #f59e0b;
}

.action-allin {
    color: #ef4444;
    font-weight: 700;
}

/* Log Entry Animation */
.log-entry {
    padding: 4px 0;
    color: var(--text-secondary);
    animation: fadeIn 0.3s ease;
}

/* API Configuration Section */
.api-config-section {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.api-config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--accent-primary);
}

.help-link {
    font-size: 12px;
    color: var(--accent-secondary);
    text-decoration: none;
}

.help-link:hover {
    text-decoration: underline;
}

.api-config-form {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 150px;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.api-key-note {
    width: 100%;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Developer Hub Styles */
.developer-container {
    max-width: 900px;
    margin: 0 auto;
}

.dev-section {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.dev-section h2 {
    margin-bottom: 16px;
    color: var(--text-primary);
}

.section-desc {
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Quick Start Steps */
.quick-start-steps {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.step {
    flex: 1;
    min-width: 200px;
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 12px;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--accent-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.step-content h4 {
    margin-bottom: 4px;
    color: var(--text-primary);
}

.step-content p {
    font-size: 13px;
    color: var(--text-muted);
}

/* API Endpoints */
.api-docs {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.endpoint {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 16px;
}

.endpoint-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.method {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.method.get {
    background: #10b981;
    color: white;
}

.method.post {
    background: #3b82f6;
    color: white;
}

.method.ws {
    background: #8b5cf6;
    color: white;
}

.endpoint code {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-secondary);
}

.endpoint p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.endpoint pre {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
    margin: 0;
}

.endpoint pre code {
    color: var(--text-secondary);
}

/* Code Blocks */
.code-block-wrapper {
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 6px 12px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    z-index: 10;
}

.copy-btn:hover {
    background: var(--accent-secondary);
}

.skill-template,
.python-code {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: 12px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
}

.skill-template code,
.python-code code {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
    white-space: pre;
}

/* Deploy Form Styles */
.deploy-section {
    border: 2px solid var(--accent-primary);
}

.deploy-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.btn-deploy {
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
}

.deploy-status {
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    text-align: center;
}

.status-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.status-icon {
    font-size: 20px;
}

.deploy-status.success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--accent-primary);
}

.deploy-status.error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
}

/* Agent-First Hero Section */
.hero-section {
    text-align: center;
    padding: 40px 24px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    border: 2px solid var(--accent-primary);
}

.hero-section h1 {
    font-size: 32px;
    margin-bottom: 16px;
}

.hero-desc {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 24px;
    line-height: 1.6;
}

.btn-large {
    padding: 16px 48px;
    font-size: 18px;
    font-weight: 700;
}

.copy-hint {
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Agent Instructions Preview */
.instructions-section {
    background: var(--bg-primary);
}

.agent-instructions {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    font-size: 12px;
    line-height: 1.5;
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.agent-instructions code {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
    white-space: pre;
}