/* Chess Bot Battle Platform Styles */

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-color: #1f2937;
    --light-color: #f8fafc;
    --border-color: #e2e8f0;
    --text-color: #374151;
    --text-light: #6b7280;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-color);
}

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

/* Navigation */
header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-container h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-container h1 a {
    text-decoration: none;
    color: var(--dark-color);
}

nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
}

nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: var(--transition);
}

nav a:hover {
    color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color), #1e40af);
    color: white;
    padding: 80px 0;
    text-align: center;
}

.hero h2 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
}

.hero-stats .stat {
    text-align: center;
}

.hero-stats .stat span {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
}

.hero-stats .stat small {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
}

/* Features */
.features {
    padding: 80px 0;
    background: white;
}

.features h3 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 60px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.feature-card {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-card h4 {
    font-size: 1.25rem;
    margin-bottom: 15px;
}

/* Recent Matches */
.recent-matches {
    padding: 60px 0;
    background: #f8fafc;
}

.recent-matches h3 {
    text-align: center;
    margin-bottom: 40px;
}

.matches-list {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.match-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.match-item:last-child {
    border-bottom: none;
}

.match-item .players {
    display: flex;
    align-items: center;
    gap: 20px;
}

.match-item .vs {
    color: var(--text-light);
    font-weight: 500;
}

.match-item .result {
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
}

.result.win { background: #dcfce7; color: #166534; }
.result.loss { background: #fee2e2; color: #991b1b; }
.result.draw { background: #fef3c7; color: #92400e; }

/* Forms */
.register-form {
    padding: 60px 0;
    background: white;
}

.register-form h2 {
    text-align: center;
    margin-bottom: 10px;
}

.register-form > .container > p {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 40px;
}

.form-group {
    margin-bottom: 30px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    resize: vertical;
    min-height: 300px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-light);
}

.code-info {
    background: #f8fafc;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.code-info h4 {
    margin-bottom: 10px;
}

.code-info ul {
    margin-left: 20px;
}

.code-info code {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* Examples */
.examples {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
}

.examples h3 {
    margin-bottom: 20px;
}

.example-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

pre {
    background: #1f2937;
    color: #f8fafc;
    padding: 20px;
    border-radius: var(--border-radius);
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
}

/* Leaderboard */
.leaderboard {
    padding: 60px 0;
}

.leaderboard h2 {
    text-align: center;
    margin-bottom: 10px;
}

.leaderboard > .container > p {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 40px;
}

.leaderboard-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
}

.search-box {
    display: flex;
    flex: 1;
    max-width: 400px;
}

.search-box input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    border-right: none;
}

.search-box button {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    background: white;
    cursor: pointer;
}

.leaderboard-table {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.bot-row {
    display: grid;
    grid-template-columns: 60px 1fr 120px 100px 100px 120px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    transition: var(--transition);
}

.bot-row:hover {
    background: #f8fafc;
}

.bot-row:last-child {
    border-bottom: none;
}

.bot-rank {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.bot-name {
    font-weight: 600;
}

.bot-author {
    color: var(--text-light);
    font-size: 0.875rem;
}

.bot-elo {
    font-weight: 700;
    font-size: 1.125rem;
}

.bot-stats {
    display: flex;
    gap: 15px;
    font-size: 0.875rem;
}

.bot-form {
    display: flex;
    gap: 2px;
}

.form-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.form-dot.win { background: var(--success-color); }
.form-dot.loss { background: var(--danger-color); }
.form-dot.draw { background: var(--warning-color); }

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

/* Bot Details */
.bot-details {
    padding: 60px 0;
}

.bot-header {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 40px;
    text-align: center;
}

.bot-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.bot-meta {
    color: var(--text-light);
    font-size: 1.125rem;
}

.bot-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.stat-card {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.stat-card h3 {
    margin-bottom: 20px;
    color: var(--dark-color);
}

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-item .label {
    color: var(--text-light);
}

.stat-item .value {
    font-weight: 600;
}

.recent-form {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}

.recent-form h3 {
    margin-bottom: 20px;
}

.form-chart {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.form-bar {
    flex: 1;
    min-width: 20px;
    height: 40px;
    border-radius: 4px;
    display: flex;
    align-items: end;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.form-bar.win { background: var(--success-color); }
.form-bar.loss { background: var(--danger-color); }
.form-bar.draw { background: var(--warning-color); }

.match-history {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.match-history h3 {
    margin-bottom: 20px;
}

.matches-table {
    overflow-x: auto;
}

.match-row {
    display: grid;
    grid-template-columns: 100px 1fr 80px 80px 100px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}

.match-row:last-child {
    border-bottom: none;
}

.match-opponent {
    font-weight: 600;
}

.match-result {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
}

/* Documentation */
.docs {
    padding: 60px 0;
}

.docs-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.doc-tab {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.doc-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.doc-section {
    display: none;
}

.doc-section.active {
    display: block;
}

.doc-section h3 {
    margin-bottom: 20px;
    color: var(--dark-color);
}

.doc-section h4 {
    margin: 30px 0 15px 0;
    color: var(--dark-color);
}

.doc-section h5 {
    margin: 20px 0 10px 0;
    color: var(--primary-color);
}

.api-endpoint {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8fafc;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

/* Result Messages */
.result-message {
    margin-top: 30px;
    padding: 20px;
    border-radius: var(--border-radius);
}

.result-message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.result-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

/* Match Viewer */
.match-viewer {
    padding: 60px 0;
}

.match-header {
    text-align: center;
    margin-bottom: 40px;
}

.match-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
    align-items: start;
}

.board-section {
    text-align: center;
}

.chessboard-container {
    margin: 0 auto 20px;
}

.board-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.players {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.player {
    text-align: center;
    flex: 1;
}

.player.white {
    color: #374151;
}

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

.vs {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 20px;
}

.match-status {
    margin-bottom: 30px;
}

.status {
    padding: 10px 20px;
    background: #f3f4f6;
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 500;
}

.moves-list {
    max-height: 400px;
    overflow-y: auto;
    background: #f8fafc;
    border-radius: var(--border-radius);
    padding: 10px;
}

.move-pair {
    display: flex;
    align-items: center;
    padding: 5px 0;
    cursor: pointer;
    border-radius: 4px;
}

.move-pair:hover {
    background: rgba(37, 99, 235, 0.1);
}

.move-pair.current {
    background: rgba(37, 99, 235, 0.2);
    font-weight: 600;
}

.move-number {
    width: 30px;
    text-align: right;
    margin-right: 10px;
    font-weight: 600;
}

.move {
    padding: 2px 6px;
    margin: 0 2px;
    background: white;
    border-radius: 3px;
    font-family: monospace;
}

.live-badge {
    background: #ef4444;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.match-list {
    margin-bottom: 40px;
}

.ongoing-matches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.match-card {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
}

.match-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.match-card h3 {
    margin-bottom: 10px;
}

/* Footer */
footer {
    background: var(--dark-color);
    color: white;
    padding: 40px 0;
    text-align: center;
}

footer p {
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 20px;
    }

    nav ul {
        margin-top: 20px;
        gap: 20px;
    }

    .hero h2 {
        font-size: 2rem;
    }

    .hero-stats {
        flex-direction: column;
        gap: 20px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .leaderboard-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: none;
    }

    .bot-row {
        grid-template-columns: 50px 1fr;
        gap: 10px;
    }

    .bot-row > div:not(:first-child) {
        display: flex;
        justify-content: space-between;
    }

    .bot-stats-grid {
        grid-template-columns: 1fr;
    }

    .match-row {
        grid-template-columns: 1fr;
        gap: 5px;
        text-align: center;
    }

    .docs-nav {
        justify-content: center;
    }
}

/* Utilities */
.text-center { text-align: center; }
.mb-20 { margin-bottom: 20px; }
.mb-40 { margin-bottom: 40px; }