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

html, body {
    width: 100%;
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a3a5a 0%, #1a5f7a 50%, #0d4a6b 100%);
    color: #333;
    position: relative;
    overflow-x: hidden;
}

/* Icicles Animation */
.icicles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.icicle {
    position: absolute;
    background: linear-gradient(to bottom, #ffffff 0%, #e0f7ff 100%);
    opacity: 0.6;
    animation: fall linear infinite;
}

@keyframes fall {
    0% {
        transform: translateY(-10px);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

@keyframes computerMoveGlow {
    0%, 100% {
        box-shadow: inset 0 0 15px rgba(255, 165, 0, 0.7);
    }
    50% {
        box-shadow: inset 0 0 25px rgba(255, 165, 0, 1);
    }
}

/* Navigation Bar */
.navbar {
    background: rgba(0, 20, 40, 0.8);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

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

.logo-small img {
    height: 40px;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #7dd3fc;
}

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    z-index: 10;
}

.logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    height: 400px;
    object-fit: contain;
}

.login-container h1 {
    color: #0a3a5a;
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.welcome-text {
    color: #666;
    text-align: center;
    margin-bottom: 2rem;
    font-style: italic;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form input {
    padding: 1rem;
    border: 2px solid #0a3a5a;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: #1a5f7a;
}

.login-form button {
    padding: 1rem;
    background: linear-gradient(135deg, #0a3a5a 0%, #1a5f7a 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(10, 58, 90, 0.3);
}

.error-message {
    color: #e74c3c;
    text-align: center;
    font-size: 0.9rem;
}

/* Config Page */
.config-page {
    min-height: 100vh;
    padding-top: 80px;
}

.config-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    z-index: 10;
    position: relative;
}

.config-container h1 {
    color: white;
    text-align: center;
    margin-bottom: 1rem;
    font-size: 2.5rem;
}

.config-container > p {
    color: #e0f7ff;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.color-selection {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
    justify-content: center;
    flex-wrap: wrap;
}

.color-option {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 2rem;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
    min-width: 250px;
}

.color-option:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.color-option.white-option {
    border: 3px solid #f5f5f5;
}

.color-option.black-option {
    border: 3px solid #333;
}

.piece-preview {
    margin: 1rem 0;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.piece-preview img {
    max-height: 120px;
    object-fit: contain;
}

.color-option h2 {
    color: #0a3a5a;
    margin: 1rem 0 0.5rem;
}

.color-option p {
    color: #666;
    margin-bottom: 1.5rem;
}

.color-option button {
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, #0a3a5a 0%, #1a5f7a 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.color-option button:hover {
    transform: scale(1.05);
}

.difficulty-selection {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
}

.difficulty-selection h2 {
    color: #0a3a5a;
    margin-bottom: 1.5rem;
}

.difficulty-options {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.difficulty-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 1.1rem;
}

.difficulty-option input {
    cursor: pointer;
    width: 20px;
    height: 20px;
}

.difficulty-option span {
    color: #0a3a5a;
    font-weight: 500;
}

/* Game Page */
.game-page {
    min-height: 100vh;
    padding-top: 80px;
    padding-bottom: 2rem;
}

.game-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 250px 1fr 200px;
    gap: 2rem;
    padding: 2rem;
    z-index: 10;
    position: relative;
}

.game-info {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.status-panel {
    text-align: center;
}

.status-panel h2 {
    color: #0a3a5a;
    margin-bottom: 0.5rem;
}

.status-panel p {
    color: #666;
    font-size: 0.95rem;
    margin: 0.3rem 0;
}

.alert-message {
    color: #e74c3c !important;
    font-weight: bold !important;
}

.game-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.new-game-btn {
    padding: 0.8rem;
    background: linear-gradient(135deg, #0a3a5a 0%, #1a5f7a 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.new-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(10, 58, 90, 0.3);
}

.secret-button button {
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.chess-board-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.chess-board-container.flipped-board .chess-board {
    transform: rotate(180deg);
}

.chess-board-container.flipped-board .piece {
    transform: rotate(180deg);
}

.chess-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0;
    border: 3px solid #0a3a5a;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    background: #1a5f7a;
}

.square {
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: all 0.2s;
}

.square.light {
    background: #e8f4f8;
}

.square.dark {
    background: #0a3a5a;
}

.square.selected {
    background: #ffd700 !important;
    box-shadow: inset 0 0 10px rgba(255, 215, 0, 0.5);
}

.square.valid-move {
    background: rgba(144, 238, 144, 0.6) !important;
}

.square.valid-move::after {
    content: '';
    width: 20px;
    height: 20px;
    background: rgba(144, 238, 144, 0.8);
    border-radius: 50%;
}

.square.last-move {
    background: rgba(100, 200, 100, 0.3) !important;
}

.square.computer-move {
    background: rgba(255, 165, 0, 0.5) !important;
    box-shadow: inset 0 0 15px rgba(255, 165, 0, 0.7);
    animation: computerMoveGlow 2s ease-in-out infinite;
}

.piece {
    width: 50px;
    height: 50px;
    object-fit: contain;
    cursor: grab;
}

.piece:active {
    cursor: grabbing;
}

.game-sidebar {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 1.5rem;
    max-height: 600px;
    overflow-y: auto;
}

.game-sidebar h3 {
    color: #0a3a5a;
    margin-bottom: 1rem;
}

.move-history {
    font-size: 0.9rem;
    line-height: 1.6;
}

.move-entry {
    color: #666;
    padding: 0.3rem 0;
    border-bottom: 1px solid #eee;
}

/* Content Pages */
.content-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    margin-top: 2rem;
    margin-bottom: 2rem;
    z-index: 10;
    position: relative;
}

.content-container h1 {
    color: #0a3a5a;
    margin-bottom: 1rem;
    font-size: 2.5rem;
    text-align: center;
}

.intro-text {
    text-align: center;
    color: #666;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    margin-bottom: 2rem;
}

.about-section h2 {
    color: #1a5f7a;
    margin: 1.5rem 0 1rem;
    font-size: 1.5rem;
}

.about-section h3 {
    color: #0a3a5a;
    margin: 1rem 0 0.5rem;
}

.bio-text p {
    color: #666;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.about-sidebar {
    text-align: center;
}

.about-logo {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.about-features {
    background: #f0f9ff;
    padding: 2rem;
    border-radius: 10px;
    border-left: 4px solid #1a5f7a;
}

.about-features h2 {
    color: #0a3a5a;
    margin-bottom: 1rem;
}

.about-features ul {
    list-style: none;
    line-height: 2;
}

.about-features li {
    color: #666;
    font-size: 1.05rem;
}

/* How to Play Styles */
.rules-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f9f9f9;
    border-radius: 10px;
}

.rules-section h2 {
    color: #1a5f7a;
    margin-bottom: 1rem;
}

.rules-section p {
    color: #666;
    line-height: 1.8;
}

.pieces-guide {
    margin: 2rem 0;
}

.pieces-guide h2 {
    color: #1a5f7a;
    margin-bottom: 1.5rem;
}

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

.piece-card {
    background: #f9f9f9;
    border: 2px solid #e0f7ff;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s;
}

.piece-card:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.piece-image {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.piece-image img {
    max-height: 100px;
    object-fit: contain;
}

.piece-card h3 {
    color: #0a3a5a;
    margin-bottom: 0.5rem;
}

.piece-card p {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0.5rem 0;
}

.special-move, .concept {
    background: #f0f9ff;
    padding: 1rem;
    border-left: 4px solid #1a5f7a;
    margin-bottom: 1rem;
    border-radius: 5px;
}

.special-move h3, .concept h3 {
    color: #0a3a5a;
    margin-bottom: 0.5rem;
}

.special-move p, .concept p {
    color: #666;
    margin: 0.5rem 0;
}

.tips-section {
    background: #fff9e6;
    padding: 1.5rem;
    border-left: 4px solid #f59e0b;
    border-radius: 10px;
    margin: 2rem 0;
}

.tips-section h2 {
    color: #0a3a5a;
    margin-bottom: 1rem;
}

.tips-section ul {
    list-style: disc;
    margin-left: 2rem;
}

.tips-section li {
    color: #666;
    margin: 0.5rem 0;
    line-height: 1.6;
}

.rules-section ol {
    margin-left: 2rem;
    color: #666;
    line-height: 2;
}

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

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
}

.modal-content h2 {
    color: #0a3a5a;
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.modal-content p {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.modal-content button {
    padding: 0.8rem 2rem;
    background: linear-gradient(135deg, #0a3a5a 0%, #1a5f7a 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
}

.modal-content button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(10, 58, 90, 0.3);
}

.modal-content.loading-content {
    max-width: 500px;
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e0f7ff;
    border-top: 4px solid #0a3a5a;
    border-radius: 50%;
    margin: 2rem auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }

/* Responsive Design */
@media (max-width: 768px) {
    .game-container {
        grid-template-columns: 1fr;
    }
    
    .color-selection {
        flex-direction: column;
        align-items: center;
    }
    
    .color-option {
        max-width: 300px;
    }
    
    .square {
        width: 50px;
        height: 50px;
    }
    
    .about-content {
        grid-template-columns: 1fr;
    }
    
    .content-container {
        margin: 1rem;
    }
    
    .nav-links {
        gap: 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .config-container h1 {
        font-size: 1.8rem;
    }
    
    .login-container {
        padding: 1.5rem;
    }
    
    .square {
        width: 40px;
        height: 40px;
    }
    
    .piece {
        width: 35px;
        height: 35px;
    }
    
    .piece-row {
        grid-template-columns: 1fr;
    }
    
    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
    }
}
