/* Global styles and body background */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2a3541 0%, #1c2836 100%);
    color: #e0e0e0;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.container {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    padding: 2rem;
    max-width: 90%;
    margin: 2rem auto;
    justify-content: center;
    align-items: flex-start;
    border-radius: 1rem;
    background-color: rgba(40, 50, 65, 0.7);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

/* Board styling */
.board-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 40rem;
    height: 40rem;
    padding: 1.25rem;
    background-color: rgba(30, 40, 55, 0.8);
    border-radius: 0.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.board {
    width: 37.5rem;
    height: 37.5rem;
    border: 0.125rem solid #333;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    transition: transform 0.3s ease;
    overflow: hidden;
    border-radius: 0.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Square styling */
.square {
    width: 4.6875rem;
    height: 4.6875rem;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.875rem;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s ease;
}

.white { 
    background-color: #eeeed2; 
}
.black { 
    background-color: #769656; 
}
.highlight { 
    background-color: rgba(255, 255, 0, 0.5) !important; 
}

.square:hover {
    box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* Sidebar and controls styling */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 20rem;
    background-color: rgba(25, 35, 50, 0.8);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
}

select {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: none;
    border-radius: 0.5rem;
    background-color: rgba(45, 55, 70, 0.9);
    color: #e0e0e0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    width: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e0e0e0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

select:hover, select:focus {
    background-color: rgba(60, 70, 85, 0.9);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    outline: none;
}

.puzzle-description {
    margin-top: 0.625rem;
    padding: 1rem;
    background-color: rgba(35, 45, 60, 0.7);
    border-radius: 0.5rem;
    border-left: 4px solid #5b86c7;
    font-style: italic;
    color: #d0d0d0;
    line-height: 1.5;
}

.status {
    margin-top: 0.625rem;
    font-size: 1.125rem;
    min-height: 1.5em;
    padding: 1rem;
    background-color: rgba(44, 82, 130, 0.3);
    border-radius: 0.5rem;
    color: #a0c8ff;
    transition: all 0.3s ease;
}

/* Piece styling */
.piece {
    user-select: none;
    -webkit-user-drag: none;
    transition: all 0.2s ease;
    transform-origin: center;
    font-size: 2.5rem;
    text-shadow: 0px 2px 3px rgba(0,0,0,0.4);
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3));
}

.piece:hover {
    transform: scale(1.1);
}

.piece.dragging {
    opacity: 0.5;
}

/* Valid move indicator */
.valid-move {
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background-color: rgba(76, 175, 80, 0.5);
    pointer-events: none;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(76, 175, 80, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

/* Animation for piece movement */
.moving-piece {
    position: absolute;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.3s ease;
    z-index: 999;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.6));
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
}

/* Coordinates styling */
.coordinates {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #a0a0a0;
    font-size: 0.875rem;
}

.file-coord {
    height: 1.25rem;
    width: 3.125rem;
    bottom: 0;
}

.rank-coord {
    width: 1.25rem;
    height: 3.125rem;
    right: 0;
}

/* Media queries for responsiveness */
@media (max-width: 1200px) {
    .container {
        flex-direction: column;
        align-items: center;
    }
    
    .sidebar {
        max-width: 37.5rem;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .board-wrapper {
        width: 100%;
        height: auto;
        aspect-ratio: 1/1;
    }
    
    .board {
        width: 100%;
        height: auto;
        aspect-ratio: 1/1;
    }
    
    .square {
        width: auto;
        height: auto;
    }
}

/* Header styling */
.header {
    text-align: center;
    padding: 1.5rem 0;
    color: #a0c8ff;
}

.header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Info box styling */
.info-box {
  max-width: 20rem;
  background-color: rgba(25, 35, 50, 0.8);
  border-radius: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  padding: 1.5rem;
  margin-top: 1.5rem;
  color: #d0d0d0;
  font-size: 0.95rem;
  line-height: 1.6;
  border-left: 4px solid #5b86c7;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.info-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.info-box-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #a0c8ff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-box-title::before {
  content: "♞";
  font-size: 1.4rem;
}

.info-box p {
  margin: 0.75rem 0;
}

.info-box p:first-of-type {
  margin-top: 0;
}

.info-box p:last-of-type {
  margin-bottom: 0;
}

.info-box a {
  color: #5b86c7;
  text-decoration: none;
  border-bottom: 1px dotted #5b86c7;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.info-box a:hover {
  color: #a0c8ff;
  border-color: #a0c8ff;
}

/* Responsive adjustment */
@media (max-width: 1200px) {
  .info-box {
    max-width: 37.5rem;
    width: 100%;
  }
}

