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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

#turn-indicator {
    font-size: 1.2rem;
    font-weight: 500;
    color: #3498db;
    margin-bottom: 10px;
}

.main-content {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

/* Chess Board Styles */
.game-container {
    flex: 1;
    min-width: 400px;
}

#chessBoard {
    width: 100%;
    aspect-ratio: 1/1;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    border: 2px solid #2c3e50;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.square {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.square.light {
    background-color: #f0d9b5;
}

.square.dark {
    background-color: #b58863;
}

.square.selected {
    background-color: rgba(106, 159, 181, 0.5);
}

.square.valid-move {
    position: relative;
}

.square.valid-move::after {
    content: '';
    position: absolute;
    width: 25%;
    height: 25%;
    border-radius: 50%;
    background-color: rgba(0, 128, 0, 0.5);
}

.square.capture-move {
    position: relative;
}

.square.capture-move::after {
    content: '';
    position: absolute;
    width: 90%;
    height: 90%;
    border-radius: 50%;
    border: 3px solid rgba(255, 0, 0, 0.7);
    box-sizing: border-box;
}

.piece {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    user-select: none;
}

.piece.white {
    color: #fff;
    text-shadow: 0 0 2px #000, 0 0 2px #000, 0 0 2px #000;
}

.piece.black {
    color: #000;
    text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 2px #fff;
}

.piece.in-check {
    color: #ff0000;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

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

/* Game Info Styles */
.game-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.score-display {
    display: flex;
    justify-content: space-around;
    font-size: 1.2rem;
    font-weight: bold;
}

.timer-container {
    position: relative;
    width: 60px;
    height: 60px;
    margin: 0 auto;
}

.timer-svg {
    transform: rotate(-90deg);
}

.timer-circle {
    fill: none;
    stroke-width: 8;
}

.timer-background {
    stroke: #eee;
}

.timer-progress {
    stroke: #4CAF50;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.1s linear;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9rem;
    font-weight: bold;
}

.move-history-container {
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.move-history-container h4 {
    margin-bottom: 10px;
    text-align: center;
}

#moveHistory {
    display: flex;
    flex-wrap: wrap;
}

.move-item {
    margin-right: 10px;
    margin-bottom: 5px;
}

.move-number {
    font-weight: bold;
    color: #666;
}

/* Controls Styles */
.controls-container {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-panel,
.analysis-panel,
.visualization-panel {
    background-color: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.control-panel h3,
.analysis-panel h3,
.visualization-panel h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.control-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.control-group label {
    margin-right: 10px;
    flex: 1;
}

.control-group input[type="text"],
.control-group select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    flex: 2;
}

.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    margin-bottom: 10px;
    width: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn.primary {
    background-color: #3498db;
    color: white;
}

.btn.secondary {
    background-color: #2ecc71;
    color: white;
}

.btn.danger {
    background-color: #e74c3c;
    color: white;
}

#skill-description {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    font-style: italic;
}

.analysis-stats {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
}

.thinking-status {
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
    transition: all 0.3s;
}

.thinking-status.active {
    background-color: #e3f2fd;
    color: #1976d2;
    animation: thinking 1.5s infinite;
}

@keyframes thinking {
    0% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.7;
    }
}

/* Move Evaluations Styles */
#move-evaluations {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 20px;
    max-height: 200px;
    overflow-y: auto;
}

.move-evaluation {
    display: flex;
    justify-content: space-between;
    padding: 5px 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    font-size: 0.9rem;
}

.move-evaluation.best {
    background-color: #e3f2fd;
    font-weight: bold;
}

.move-evaluation span:nth-child(2) {
    font-weight: bold;
}

.move-evaluation span:nth-child(3) {
    color: #666;
    font-size: 0.8rem;
}

/* Column Strength Bars */
#column-strength-bars {
    display: flex;
    justify-content: space-between;
    height: 150px;
    margin-bottom: 20px;
    background-color: #f9f9f9;
    border-radius: 4px;
    padding: 10px;
}

.strength-bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 0 2px;
}

.strength-bar {
    width: 100%;
    background-color: #ccc;
    position: relative;
    border-radius: 2px 2px 0 0;
    transition: height 0.3s;
}

.strength-bar.positive {
    background-color: #4CAF50;
}

.strength-bar.negative {
    background-color: #f44336;
}

.strength-bar.best {
    background-color: #2196F3;
}

.strength-bar.worst {
    background-color: #FF9800;
}

.strength-bar-value {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    font-weight: bold;
}

.strength-bar-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
}

/* Advanced Analysis Controls */
.advanced-analysis,
.chart-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.advanced-analysis button,
.chart-controls button {
    flex: 1;
}

.advanced-analysis select {
    width: 100px;
}

/* AI Thinking Visualization */
.ai-thinking-pulse {
    animation: thinking-pulse 1.5s infinite;
}

@keyframes thinking-pulse {
    0% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.7;
    }
}

/* Move Evaluation Popup */
.move-evaluation-popup {
    position: absolute;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    padding: 10px;
    z-index: 100;
    min-width: 150px;
}

.eval-header {
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.eval-score {
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
}

.eval-score.positive {
    color: #4CAF50;
}

.eval-score.negative {
    color: #f44336;
}

.eval-score.neutral {
    color: #FFC107;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: -300px;
    width: 300px;
    padding: 15px;
    background-color: #2c3e50;
    color: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease-out;
    z-index: 1000;
}

/* Responsive Design */
@media (max-width: 1000px) {
    .main-content {
        flex-direction: column;
    }

    .game-container {
        min-width: 100%;
    }

    #chessBoard {
        max-width: 500px;
        margin: 0 auto;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    .game-info {
        padding: 10px;
    }

    .piece {
        font-size: 2rem;
    }

    .advanced-analysis,
    .chart-controls {
        flex-direction: column;
    }
}

.opening-info {
    margin-top: 10px;
    padding: 8px;
    background-color: #f5f5f5;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.opening-info h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: #555;
}

#openingName {
    font-weight: bold;
    color: #333;
    font-size: 16px;
}

/* Chess Tutelage System Styles */
.tutelage-panel {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tutelage-panel h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

.tutelage-panel h5 {
    margin-top: 15px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #555;
}

.tutelage-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.tutelage-controls label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.tutelage-controls input[type="checkbox"] {
    margin-right: 5px;
}

.tutelage-controls button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.3s;
}

.tutelage-controls button:hover {
    background-color: #45a049;
}

#recognized-patterns,
#detected-motifs {
    font-size: 13px;
    color: #555;
    max-height: 80px;
    overflow-y: auto;
    padding: 8px;
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 3px;
    min-height: 40px;
}

.pattern-tag {
    display: inline-block;
    margin: 2px;
    padding: 2px 6px;
    background-color: #e1f5fe;
    border-radius: 3px;
    font-size: 12px;
    color: #0277bd;
}

.motif-tag {
    display: inline-block;
    margin: 2px;
    padding: 2px 6px;
    background-color: #ffe0b2;
    border-radius: 3px;
    font-size: 12px;
    color: #e65100;
}

.learning-stats {
    margin-top: 15px;
    font-size: 13px;
    color: #555;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.learning-stats div {
    background-color: #f5f5f5;
    padding: 5px 8px;
    border-radius: 3px;
    text-align: center;
}

.learning-stats span {
    font-weight: bold;
    color: #333;
}

/* Learned Moves Modal */
.learned-move-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.learned-move-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    max-width: 80%;
    max-height: 80%;
    overflow-y: auto;
}

.learned-move-content h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.learned-move {
    background-color: #e8f5e9;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    font-size: 13px;
}

.learned-move strong {
    color: #2e7d32;
}

.learned-move-content button {
    margin-top: 15px;
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.learned-move-content button:hover {
    background-color: #45a049;
}

/* Animation for pattern detection */
@keyframes pattern-pulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }

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

    100% {
        transform: scale(1);
        opacity: 0.7;
    }
}

.pattern-highlight {
    position: absolute;
    pointer-events: none;
    border: 2px solid rgba(76, 175, 80, 0.7);
    border-radius: 50%;
    z-index: 10;
    animation: pattern-pulse 1.5s infinite;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tutelage-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

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

/* Tutelage panel state transitions */
.tutelage-panel.changing {
    opacity: 0.5;
    transition: opacity 0.3s;
}

/* Different color themes for different pattern types */
.pattern-recognition .pattern-tag.pawn-structure {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.pattern-recognition .pattern-tag.piece-placement {
    background-color: #e3f2fd;
    color: #1565c0;
}

.pattern-recognition .pattern-tag.king-safety {
    background-color: #fff3e0;
    color: #e65100;
}

.pattern-recognition .pattern-tag.center-control {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

/* Different color themes for different tactical motifs */
.tactical-motifs .motif-tag.fork {
    background-color: #ffebee;
    color: #c62828;
}

.tactical-motifs .motif-tag.pin {
    background-color: #e8eaf6;
    color: #3949ab;
}

.tactical-motifs .motif-tag.skewer {
    background-color: #e0f2f1;
    color: #00796b;
}

.tactical-motifs .motif-tag.discovered-attack {
    background-color: #fce4ec;
    color: #c2185b;
}

.tactical-motifs .motif-tag.mate-pattern {
    background-color: #ffcdd2;
    color: #b71c1c;
}

.enhanced-tutor-panel {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.enhanced-tutor-panel h4 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

.tutor-section {
    margin-bottom: 15px;
}

.tutor-section h5 {
    margin: 10px 0 5px;
    color: #3498db;
}

.progress-container {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.progress-bar {
    flex-grow: 1;
    height: 12px;
    background-color: #ecf0f1;
    border-radius: 6px;
    overflow: hidden;
    margin-right: 10px;
}

.progress-fill {
    height: 100%;
    background-color: #2ecc71;
    width: 0%;
    transition: width 0.5s ease-in-out;
}

.progress-label {
    font-weight: bold;
    min-width: 40px;
    text-align: right;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.9em;
}

#game-insights {
    padding: 8px;
    background-color: #fff;
    border-left: 3px solid #3498db;
    font-style: italic;
    min-height: 40px;
}

.tutor-controls {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    margin-bottom: 10px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 20px;
    transition: .4s;
    margin-right: 8px;
    vertical-align: middle;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

.toggle-label {
    vertical-align: middle;
}

input:checked+.toggle-slider {
    background-color: #2196F3;
}

input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

.button-row {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.tutor-button {
    padding: 6px 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

.tutor-button:hover {
    background-color: #2980b9;
}

.tutor-button.danger {
    background-color: #e74c3c;
}

.tutor-button.danger:hover {
    background-color: #c0392b;
}

.insight-highlight {
    background-color: rgba(52, 152, 219, 0.1);
    border-left: 3px solid #3498db;
    padding: 8px;
    margin: 5px 0;
    border-radius: 0 4px 4px 0;
    animation: fadeIn 0.5s;
}

.insight-highlight.positive {
    background-color: rgba(46, 204, 113, 0.1);
    border-left-color: #2ecc71;
}

.insight-highlight.negative {
    background-color: rgba(231, 76, 60, 0.1);
    border-left-color: #e74c3c;
}

.insight-highlight.neutral {
    background-color: rgba(241, 196, 15, 0.1);
    border-left-color: #f1c40f;
}

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

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

/* Modal profile styling improvements */
.profile-modal .modal-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.profile-modal .modal-section:last-child {
    border-bottom: none;
}

.profile-modal .strengths-weaknesses {
    display: flex;
    flex-direction: row;
    gap: 20px;
}

.profile-modal .strengths,
.profile-modal .weaknesses {
    flex: 1;
}

.profile-modal .skill-bars {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.profile-modal h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.profile-modal h5 {
    margin-top: 0;
    margin-bottom: 10px;
}

.profile-modal ul {
    margin: 0;
    padding-left: 20px;
}

.profile-modal li {
    margin-bottom: 5px;
}