/**
 * CAISSA DOS Chess Styles
 * Classic DOS chess games player
 */

/* ===== DOS CHESS SECTION ===== */
#dosChessSection {
    display: none;
}

#dosChessSection.active {
    display: block;
}

.dos-chess-layout {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    height: calc(100vh - 80px);
    overflow-y: auto;
}

/* ===== HEADER ===== */
.dos-chess-header {
    margin-bottom: 24px;
}

.dos-chess-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dos-chess-title i {
    color: var(--accent-color);
}

.dos-chess-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* ===== CONTROLS ===== */
.dos-chess-controls {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
}

.dos-search-bar {
    position: relative;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
}

.dos-search-bar i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

.dos-search-bar input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
}

.dos-search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.dos-filters {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.dos-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dos-filter-group label {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.dos-filter-chips {
    display: flex;
    gap: 8px;
}

.dos-filter-chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.dos-filter-chip:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

.dos-filter-chip.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* ===== GAMES GRID ===== */
.dos-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.dos-game-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    transition: all 0.3s ease;
}

.dos-game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-color);
}

.dos-game-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.dos-game-badge.2d {
    background: #3b82f6;
    color: white;
}

.dos-game-badge.3d {
    background: #8b5cf6;
    color: white;
}

.dos-game-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.dos-game-icon i {
    font-size: 28px;
    color: white;
}

.dos-game-info {
    margin-bottom: 16px;
}

.dos-game-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.dos-game-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.dos-game-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dos-game-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 12px 0;
}

.dos-game-features {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.dos-feature-tag {
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 500;
}

.dos-game-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.dos-game-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.dos-play-btn,
.dos-download-btn,
.dos-retro-btn,
.dos-hosted-btn {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.dos-hosted-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
}

.dos-hosted-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

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

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

.dos-download-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.dos-download-btn:hover {
    background: var(--bg-secondary);
}

.dos-retro-btn {
    background: transparent;
    color: var(--text-tertiary);
    border-color: var(--border-color);
    font-size: 12px;
    padding: 6px 12px;
}

.dos-retro-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dos-external-note {
    font-size: 11px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.dos-external-note i {
    font-size: 10px;
}

/* ===== LOADING & ERROR STATES ===== */
.dos-loading,
.dos-error,
.dos-no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

.dos-loading i,
.dos-error i,
.dos-no-results i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--accent-color);
}

.dos-loading p,
.dos-error p,
.dos-no-results p {
    font-size: 16px;
    margin: 0;
}

/* ===== FALLBACK BANNER ===== */
.dos-fallback-banner {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: 8px;
    margin-bottom: 20px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

.dos-fallback-content {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #78350f;
}

.dos-fallback-content i {
    font-size: 24px;
    flex-shrink: 0;
}

.dos-fallback-content > div {
    flex: 1;
}

.dos-fallback-content strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.dos-fallback-content p {
    font-size: 12px;
    margin: 0;
    opacity: 0.9;
    white-space: pre-line;
    font-family: 'Courier New', monospace;
}

.dos-fallback-content button {
    flex-shrink: 0;
    background: #78350f;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.dos-fallback-content button:hover {
    background: #451a03;
}

/* ===== DOS PLAYER MODAL ===== */
.dos-player-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    flex-direction: column;
}

.dos-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.dos-player-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.dos-player-title i {
    color: var(--accent-color);
}

.dos-player-controls {
    display: flex;
    gap: 8px;
}

.dos-btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.dos-btn-icon:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.dos-player-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #000;
}

.dos-player-loading {
    text-align: center;
    color: white;
}

.dos-player-loading i {
    font-size: 48px;
    margin-bottom: 16px;
}

.dos-player-loading p {
    font-size: 16px;
    margin: 0;
}

.dos-player-error {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000;
    color: white;
    padding: 40px;
    text-align: center;
}

.dos-player-error i {
    font-size: 64px;
    color: #f59e0b;
    margin-bottom: 20px;
}

.dos-player-error p {
    font-size: 18px;
    margin: 0 0 12px 0;
}

.dos-player-error small {
    font-size: 14px;
    color: #9ca3af;
}

.dos-player-error code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

/* ===== PLACEHOLDER CONTENT ===== */
.dos-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.dos-placeholder-content {
    max-width: 600px;
    padding: 40px;
    text-align: center;
    color: white;
}

.dos-placeholder-icon {
    font-size: 72px;
    color: var(--accent-color);
    margin-bottom: 20px;
}

.dos-placeholder-content h3 {
    font-size: 24px;
    margin: 0 0 16px 0;
}

.dos-placeholder-content p {
    font-size: 14px;
    color: #cbd5e1;
    line-height: 1.6;
    margin: 12px 0;
}

.dos-placeholder-content ol {
    font-size: 13px;
    color: #e2e8f0;
    line-height: 1.8;
}

.dos-placeholder-content code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

/* ===== JS-DOS EMULATOR ===== */
.dos-emulator-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #000;
}

.dos-hint {
    background: rgba(251, 191, 36, 0.9);
    color: #78350f;
    padding: 12px 20px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px solid rgba(120, 53, 15, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.dos-hint::before {
    content: '💡';
    font-size: 16px;
}

.dos-canvas-container {
    flex: 1;
    min-height: 60vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    position: relative;
    overflow: hidden;
}

.dos-canvas-container:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: -2px;
}

.dos-canvas-container canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .dos-chess-layout {
        padding: 16px;
    }

    .dos-chess-title {
        font-size: 22px;
    }

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

    .dos-search-bar {
        max-width: none;
    }

    .dos-games-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .dos-player-header {
        padding: 12px 16px;
    }

    .dos-player-title {
        font-size: 16px;
    }

    .dos-btn-icon {
        width: 36px;
        height: 36px;
    }
}
