/* ===================================
   SIEMENS CHESS - MAIN STYLESHEET
   =================================== */

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

:root {
    --siemens-teal: #009999;
    --siemens-dark-teal: #006666;
    --siemens-light-teal: #00CCCC;
    --light-square: #F0D9B5;
    --dark-square: #B58863;
    --highlight-color: rgba(255, 255, 0, 0.4);
    --check-color: rgba(255, 0, 0, 0.5);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* ===================================
   HEADER
   =================================== */

header {
    background: linear-gradient(135deg, var(--siemens-teal) 0%, var(--siemens-dark-teal) 100%);
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 15s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.header-content {
    position: relative;
    z-index: 1;
}

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 2px;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* ===================================
   GAME CONTAINER
   =================================== */

.game-container {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 20px;
    padding: 30px;
    background: #f8f9fa;
}

/* ===================================
   PANELS
   =================================== */

.panel {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.panel h3 {
    margin-bottom: 15px;
    color: var(--siemens-teal);
    font-size: 1.2em;
    border-bottom: 2px solid var(--siemens-light-teal);
    padding-bottom: 8px;
}

.panel select,
.panel input[type="color"],
.panel input[type="range"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.panel select:focus,
.panel input:focus {
    outline: none;
    border-color: var(--siemens-teal);
}

.panel label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.color-picker label {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.color-picker input[type="color"] {
    width: 60px;
    height: 40px;
    border: none;
    cursor: pointer;
}

/* ===================================
   BUTTONS
   =================================== */

.btn {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--siemens-teal) 0%, var(--siemens-dark-teal) 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 153, 153, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--siemens-dark-teal) 0%, var(--siemens-teal) 100%);
    box-shadow: 0 6px 12px rgba(0, 153, 153, 0.4);
    transform: translateY(-2px);
}

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

.btn-secondary {
    background: #6c757d;
    color: white;
    box-shadow: 0 4px 6px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover {
    background: #5a6268;
    box-shadow: 0 6px 12px rgba(108, 117, 125, 0.4);
    transform: translateY(-2px);
}

/* ===================================
   BOARD CONTAINER
   =================================== */

.board-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.status-bar {
    width: 100%;
    max-width: 680px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    font-size: 18px;
    font-weight: bold;
}

#current-player {
    color: var(--siemens-teal);
    font-size: 20px;
}

#game-state {
    color: #dc3545;
    font-size: 20px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.5; }
}

/* ===================================
   CHESS BOARD
   =================================== */

.chess-board {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.chess-square {
    transition: box-shadow 0.2s, transform 0.1s;
    position: relative;
}

.chess-square:hover {
    box-shadow: inset 0 0 0 3px rgba(0, 153, 153, 0.6);
    cursor: pointer;
}

.chess-square.highlighted {
    box-shadow: inset 0 0 0 4px var(--highlight-color);
}

.chess-square.in-check {
    box-shadow: inset 0 0 0 4px var(--check-color);
    animation: checkPulse 1s infinite;
}

@keyframes checkPulse {
    0%, 100% { box-shadow: inset 0 0 0 4px var(--check-color); }
    50% { box-shadow: inset 0 0 0 6px var(--check-color); }
}

.coordinate {
    position: absolute;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    pointer-events: none;
    user-select: none;
}

/* ===================================
   CHESS PIECES
   =================================== */

.chess-piece {
    transition: transform 0.2s, filter 0.2s;
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.3));
}

.chess-piece:hover {
    transform: scale(1.15);
    filter: drop-shadow(3px 3px 5px rgba(0, 0, 0, 0.5));
    cursor: grab;
}

.chess-piece:active {
    cursor: grabbing;
    transform: scale(1.2);
}

.chess-piece.dragging {
    opacity: 0.5;
}

/* ===================================
   MESSAGE BOX
   =================================== */

.message-box {
    padding: 20px;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #ffc107;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 18px;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   MOVE HISTORY
   =================================== */

.move-list {
    max-height: 350px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.move-list::-webkit-scrollbar {
    width: 8px;
}

.move-list::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 4px;
}

.move-list::-webkit-scrollbar-thumb {
    background: var(--siemens-teal);
    border-radius: 4px;
}

.move-item {
    padding: 8px;
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.2s;
}

.move-item:hover {
    background: #e9ecef;
}

.move-item:nth-child(odd) {
    background: white;
}

.move-item:nth-child(odd):hover {
    background: #e9ecef;
}

/* ===================================
   CAPTURED PIECES
   =================================== */

.captured-pieces {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.captured-section {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
}

.captured-section strong {
    display: block;
    margin-bottom: 8px;
    color: var(--siemens-teal);
}

.captured-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 40px;
}

.captured-piece {
    width: 32px;
    height: 32px;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.3));
}

/* ===================================
   STATISTICS
   =================================== */

#statistics p {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    font-size: 15px;
}

#statistics span {
    font-weight: bold;
    color: var(--siemens-teal);
}

/* ===================================
   FOOTER
   =================================== */

footer {
    background: #343a40;
    color: white;
    text-align: center;
    padding: 25px;
}

footer p {
    margin: 5px 0;
}

footer a {
    color: var(--siemens-light-teal);
    text-decoration: none;
    transition: color 0.3s;
}

footer a:hover {
    color: white;
    text-decoration: underline;
}

.version {
    font-size: 0.9em;
    opacity: 0.8;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

@media (max-width: 1400px) {
    .game-container {
        grid-template-columns: 250px 1fr 250px;
    }
}

@media (max-width: 1200px) {
    .game-container {
        grid-template-columns: 1fr;
    }

    .sidebar-left, .sidebar-right {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 15px;
    }

    .panel {
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }

    .game-container {
        padding: 15px;
    }

    .sidebar-left, .sidebar-right {
        grid-template-columns: 1fr;
    }

    .chess-board {
        width: 100% !important;
        height: auto !important;
    }

    .status-bar {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.5em;
    }

    .btn {
        font-size: 13px;
        padding: 10px;
    }
}

/* ===================================
   LOADING ANIMATION
   =================================== */

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 153, 153, 0.3);
    border-radius: 50%;
    border-top-color: var(--siemens-teal);
    animation: spin 1s ease-in-out infinite;
}

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

/* ===================================
   MODAL (für Game Over)
   =================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 30px;
    border-radius: 12px;
    width: 80%;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    color: var(--siemens-teal);
    margin-bottom: 20px;
}

.modal-content button {
    margin: 10px;
}