/* Stockfish API Documentation Styles */

/* CSS Variables */
:root {
    --primary: #8B4513;
    --primary-dark: #6b3510;
    --secondary: #D4AF37;
    --accent: #CD7F32;
    --light: #F5F5DC;
    --dark: #2F1B0C;
    --text: #333;
    --text-light: #666;
    --white: #fff;
    --gray: #f8f9fa;
    --code-bg: #1e1e1e;
    --code-text: #d4d4d4;
    --border: #e0e0e0;
    --shadow: rgba(0, 0, 0, 0.1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--light);
    min-width: 320px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Typography */
h1, h2, h3 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--dark);
}

h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    border-bottom: 2px solid var(--secondary);
    padding-bottom: 0.5rem;
    margin-top: 2rem;
}

h3 {
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
    color: var(--primary);
}

p {
    margin-bottom: 1rem;
    color: var(--text);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Navigation */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--light), var(--white));
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 4px var(--shadow);
}

.logo {
    font-size: 1.25rem;
    font-weight: 800;
}

.logo a {
    font-size: 1.5rem;
    color: var(--primary);
}

.logo a:hover {
    color: var(--primary-dark);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1rem;
}

.nav-links li {
    position: relative;
}

.nav-links a {
    color: var(--text);
    font-weight: 500;
    padding: 0.5rem 0;
    transition: color 0.2s ease;
}

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

.nav-links a.active,
.nav-links a:hover {
    color: var(--primary);
}

.nav-links a.active::after,
.nav-links a:hover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, var(--white), var(--light));
    border-bottom: 1px solid var(--border);
}

.hero h1 {
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.hero .subtitle {
    color: var(--text-light);
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
}

.version-badge {
    display: inline-block;
    background: var(--primary);
    color: var(--white);
    padding: 0.25rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px var(--shadow);
    border: 1px solid var(--border);
}

.card h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--white);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: 'Courier New', monospace;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

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

.preset-btn {
    background: var(--secondary);
    color: var(--dark);
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
}

.preset-btn:hover {
    background: #C0C0C0;
}

/* Code Blocks */
.code-block {
    position: relative;
    margin: 1rem 0;
}

pre {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 1.5rem;
    border-radius: 10px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

pre code {
    color: inherit;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary);
    color: var(--white);
    padding: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.code-block:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: var(--primary-dark);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

th, td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--gray);
    font-weight: 600;
    color: var(--dark);
}

tr:hover {
    background: rgba(220, 190, 100, 0.05);
}

.param-table th, .evaluation-table th {
    background: var(--secondary);
}

.param-table td code, .evaluation-table td code {
    background: var(--gray);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: var(--primary);
}

/* Endpoint Styles */
.endpoint-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

.endpoint-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.method {
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.method.get {
    background: #28a745;
    color: var(--white);
}

.method.post {
    background: #007bff;
    color: var(--white);
}

.method.ws {
    background: #17a2b8;
    color: var(--white);
}

.endpoint-card h3 {
    font-size: 1.25rem;
    color: var(--dark);
    margin: 0;
}

/* Result Section */
.result-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.result-item {
    background: var(--gray);
    padding: 1rem;
    border-radius: 8px;
}

.result-item .label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.result-item .value {
    font-weight: 600;
    color: var(--dark);
}

.evaluation-table-container {
    overflow-x: auto;
}

.evaluation-table {
    font-size: 0.9rem;
}

.evaluation-table th, .evaluation-table td {
    padding: 0.5rem 0.75rem;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--gray);
    border-radius: 8px;
    margin-top: 1rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error Message */
.error-message {
    margin-top: 1rem;
    padding: 1rem;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    color: #c00;
    display: none;
}

/* Footer */
footer {
    margin-top: 3rem;
    padding: 1.5rem;
    background: var(--gray);
    text-align: center;
    border-top: 1px solid var(--border);
}

footer a {
    color: var(--primary);
    font-weight: 600;
}

/* Preset Positions */
.presets {
    margin-top: 2rem;
}

.presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.preset-position {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-position:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px var(--shadow);
    border-color: var(--primary);
}

.preset-name {
    font-weight: 600;
    color: var(--text);
}

/* Quick Start */
.quick-start {
    margin: 2rem 0;
}

.quick-start h2 {
    color: var(--dark);
}

/* Health Check */
.health-check {
    margin: 2rem 0;
}

.health-check h2 {
    color: var(--dark);
}

/* Rate Limiting */
.rate-limiting {
    margin: 2rem 0;
}

.rate-limiting ul {
    margin-left: 1.5rem;
}

.rate-limiting li {
    margin-bottom: 0.5rem;
}

/* FEN Format */
.fen-format {
    margin: 2rem 0;
}

.fen-explained {
    margin-top: 1rem;
}

/* Error Handling */
.error-handling {
    margin: 2rem 0;
}

/* Example Styles */
.example-card {
    margin-bottom: 2rem;
}

.examples-section {
    margin: 2rem 0;
}

.examples-section h2 {
    color: var(--primary);
    margin-top: 2.5rem;
}

.examples-section > h2 {
    border-color: var(--primary);
}

/* WebSocket Example */
#ws-example {
    background: linear-gradient(135deg, var(--code-bg), var(--dark));
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1.5rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-links li {
        margin: 0 0.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

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

    .endpoint-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .hero {
        padding: 2rem 1rem;
    }

    .card {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .navbar .nav-links a {
        padding: 0.75rem 0;
        font-size: 0.9rem;
    }

    pre {
        font-size: 0.8rem;
        padding: 1rem;
    }

    .table th, .table td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .btn:hover {
        transform: none;
    }
}

/* Print Styles */
@media print {
    .navbar {
        display: none;
    }
    
    .hero {
        background: none;
        padding: 0;
        border-bottom: 2px solid #000;
    }
    
    .copy-btn {
        display: none;
    }
    
    .card {
        page-break-inside: avoid;
        border: 1px solid #ccc;
    }
}

/* Status Card */
.status-card {
    text-align: center;
    padding: 2rem;
    background: var(--gray);
    border-radius: 12px;
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 1.125rem;
    font-weight: 600;
}

.pulse {
    width: 12px;
    height: 12px;
    background: var(--text-light);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-online .pulse {
    background: #28a745;
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
}

.status-offline .pulse {
    background: #dc3545;
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

.status-details {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.spinner {
    animation: spin 1s linear infinite;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

.hidden {
    display: none !important;
}