/* ConilChess Web Streaming - Estilos CSS Simplificados */

/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a1a2e;
    --secondary-color: #16213e;
    --accent-color: #0f3460;
    --highlight-color: #e94560;
    --success-color: #00d4aa;
    --warning-color: #ffd700;
    --error-color: #ff4757;
    --text-primary: #ffffff;
    --text-secondary: #b8bcc8;
    --text-muted: #6c7293;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 15px 35px rgba(0, 0, 0, 0.2);
    --border-radius: 12px;
    --border-radius-large: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 50%, var(--accent-color) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animaciones globales */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Layout principal */
.container {
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Sección del tablero */
.board-section {
    display: flex;
    flex-direction: column;
}

.board-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-large);
    padding: 24px;
    box-shadow: var(--shadow-medium);
    animation: fadeIn 0.6s ease-out;
}

.board-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.board-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.board-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.board-title i {
    font-size: 1.5rem;
    color: var(--highlight-color);
}

.board-title h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

.board-controls {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--highlight-color);
    color: white;
    transform: translateY(-2px);
}

.btn-icon:active {
    background: var(--glass-bg);
    color: var(--text-secondary);
    transform: translateY(0);
}

.btn-icon:focus {
    outline: 2px solid var(--highlight-color);
    outline-offset: 2px;
}

.chess-board-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 35px 20px;
    min-height: 520px;
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-medium);
    animation: fadeIn 0.6s ease-out;
}
");

.chessboard {
    width: 480px;
    height: 480px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    aspect-ratio: 1;
}

/* Panel lateral */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel-section {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-large);
    padding: 20px;
    box-shadow: var(--shadow-medium);
    animation: fadeIn 0.6s ease-out;
}

.panel-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-section h3::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--highlight-color);
    border-radius: 2px;
}

/* Información del juego */
.game-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
    border-bottom: none;
}

.info-item .label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-item .value {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Historial de movimientos */
.moves-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
}

.moves-list::-webkit-scrollbar {
    width: 6px;
}

.moves-list::-webkit-scrollbar-track {
    background: var(--glass-bg);
    border-radius: 3px;
}

.moves-list::-webkit-scrollbar-thumb {
    background: var(--highlight-color);
    border-radius: 3px;
}

.moves-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

.move-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    margin-bottom: 4px;
    background: var(--glass-bg);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    transition: var(--transition);
}

.move-item:hover {
    background: var(--accent-color);
    transform: translateX(4px);
}

.move-number {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    min-width: 24px;
}

.move-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
    flex: 1;
}

.move-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.no-moves {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 20px;
}

/* Controles */
.controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--highlight-color), #ff6b7a);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: var(--accent-color);
    color: var(--text-primary);
}

/* Notificaciones */
.notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    color: var(--text-primary);
    box-shadow: var(--shadow-medium);
    animation: fadeIn 0.3s ease-out;
    max-width: 300px;
}

.notification.success {
    border-left: 4px solid var(--success-color);
}

.notification.error {
    border-left: 4px solid var(--error-color);
}

.notification.warning {
    border-left: 4px solid var(--warning-color);
}

/* ========================================
   RELOJ DE AJEDREZ
   ======================================== */

.clock-section {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #0f3460;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.clock-section h3 {
    color: #fff;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.clock-section h3 i {
    color: #4ecca3;
}

.chess-clock {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.clock-player {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px 15px;
    transition: all 0.3s ease;
    /* NUEVO: Layout horizontal */
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.clock-player.active {
    background: rgba(78, 204, 163, 0.15);
    border-color: #4ecca3;
    box-shadow: 0 0 20px rgba(78, 204, 163, 0.3);
    transform: scale(1.02);
}

.clock-player.time-warning {
    background: rgba(255, 193, 7, 0.15);
    border-color: #ffc107;
    animation: pulse-warning 1.5s ease-in-out infinite;
}

.clock-player.time-critical {
    background: rgba(244, 67, 54, 0.15);
    border-color: #f44336;
    animation: pulse-critical 0.8s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 193, 7, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.6);
    }
}

@keyframes pulse-critical {
    0%, 100% {
        box-shadow: 0 0 15px rgba(244, 67, 54, 0.4);
    }
    50% {
        box-shadow: 0 0 30px rgba(244, 67, 54, 0.8);
    }
}

.clock-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clock-player.active .clock-label {
    color: #4ecca3;
}

.clock-time {
    font-size: 28px;  /* Reducido de 36px */
    font-weight: 700;
    color: #fff;
    font-family: 'Courier New', monospace;
    text-align: right;
    letter-spacing: 1px;
}

.clock-player.time-warning .clock-time {
    color: #ffc107;
}

.clock-player.time-critical .clock-time {
    color: #f44336;
}

.clock-info {
    text-align: center;
    padding: 8px 10px;
    background: rgba(78, 204, 163, 0.1);
    border: 1px solid rgba(78, 204, 163, 0.3);
    border-radius: 6px;
    color: #4ecca3;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;  /* NUEVO: Separación con los relojes */
}

.clock-info i {
    color: #4ecca3;
}

/* Responsive */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr 300px;
    }
}

/* Estilos de volteo para pantallas grandes */
@media (min-width: 769px) {
    .chess-board-container {
        padding: 20px;
        min-height: 550px;
    }
    
    .chessboard {
        transition: transform 0.5s ease-in-out;
    }
    
    .chessboard.flipped {
        transform: rotate(180deg);
    }
    
    .chess-piece {
        transition: transform 0.5s ease-in-out;
    }
    
    .chessboard.flipped .chess-piece {
        transform: rotate(180deg);
    }
    
.board-files-top,
.board-files-bottom,
.board-ranks-left,
.board-ranks-right {
        transition: transform 0.5s ease-in-out;
    }
    
    .chessboard.flipped .board-files,
    .chessboard.flipped .board-ranks {
        transform: rotate(180deg);
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .board-section {
        padding: 20px;
    }
    
    .board-container {
        padding: 20px; /* Igualar padding con panel-section */
    }
    
    .chess-board-container {
        padding: 20px;
        min-height: 450px;
        overflow: visible;
    }
    
    .chessboard {
        max-width: 400px;
        width: 100%;
        height: auto;
        aspect-ratio: 1;
        transition: transform 0.5s ease-in-out;
    }
    
    .chessboard.flipped {
        transform: rotate(180deg);
    }
    
    .chess-piece {
        transition: transform 0.5s ease-in-out;
    }
    
    .chessboard.flipped .chess-piece {
        transform: rotate(180deg);
    }
    
    /* Ajustar coordenadas para móvil */
    .board-files-top {
        top: -25px !important;
        font-size: 14px !important;
    }
    
    .board-files-bottom {
        bottom: -25px !important;
        font-size: 14px !important;
    }
    
    .board-ranks-left {
        left: -25px !important;
        font-size: 14px !important;
    }
    
    .board-ranks-right {
        right: -25px !important;
        font-size: 14px !important;
    }
    
    .board-files-top,
    .board-files-bottom,
    .board-ranks-left,
    .board-ranks-right {
        transition: transform 0.5s ease-in-out;
    }
    
    .chessboard.flipped .board-files,
    .chessboard.flipped .board-ranks {
        transform: rotate(180deg);
    }
    
    .controls {
        flex-direction: column;
    }
    
    .clock-time {
        font-size: 24px;
    }
    
    .clock-label {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .panel-section {
        padding: 16px;
    }
    
    .board-container {
        padding: 16px; /* Igualar padding con panel-section */
    }
    
    .chess-board-container {
        padding: 16px;
        min-height: 400px;
        overflow: visible;
    }
    
    .chessboard {
        max-width: 350px;
        width: 100%;
        height: auto;
        aspect-ratio: 1;
        transition: transform 0.5s ease-in-out;
    }
    
    .chessboard.flipped {
        transform: rotate(180deg);
    }
    
    .chess-piece {
        transition: transform 0.5s ease-in-out;
    }
    
    .chessboard.flipped .chess-piece {
        transform: rotate(180deg);
    }
    
    /* Ajustar coordenadas para pantallas muy pequeñas */
    .board-files-top {
        top: -20px !important;
        font-size: 12px !important;
    }
    
    .board-files-bottom {
        bottom: -20px !important;
        font-size: 12px !important;
    }
    
    .board-ranks-left {
        left: -20px !important;
        font-size: 12px !important;
    }
    
    .board-ranks-right {
        right: -20px !important;
        font-size: 12px !important;
    }
    
.board-files-top,
.board-files-bottom,
.board-ranks-left,
.board-ranks-right {
        transition: transform 0.5s ease-in-out;
    }
    
    .chessboard.flipped .board-files,
    .chessboard.flipped .board-ranks {
        transform: rotate(180deg);
    }
}

/* Funcionalidades del tablero */
.chessboard {
    transition: transform 0.5s ease-in-out;
}

.chessboard.flipped {
    transform: rotate(180deg);
}

/* Mantener orientación correcta de las piezas cuando el tablero está volteado */
.chess-piece {
    transition: transform 0.5s ease-in-out;
}

.chessboard.flipped .chess-piece {
    transform: rotate(180deg);
}

/* Ajustar coordenadas cuando el tablero está volteado */
.board-files-top,
.board-files-bottom,
.board-ranks-left,
.board-ranks-right {
    transition: transform 0.5s ease-in-out;
}

.chessboard.flipped .board-files-top,
.chessboard.flipped .board-files-bottom,
.chessboard.flipped .board-ranks-left,
.chessboard.flipped .board-ranks-right {
    transform: rotate(180deg);
}
