/* 🌸 Love Puzzle Page Styling (Dark Mode First) */

/* ========== Layout ========== */
.content-section {
    max-width: 1000px;
    margin: 43px auto;
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
}

/* ========== Puzzle Grid ========== */
.puzzle-grid {
    display: grid;
    margin: 20px auto;
    box-sizing: border-box;
    aspect-ratio: 1 / 1;
    width: 350px;

    opacity: 1; /* Start fully visible */
    transition: opacity 0.2s ease-in-out; 
}

.puzzle-piece {
    box-sizing: border-box;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.25s, outline 0.25s, box-shadow 0.25s;
    /* The border property is now completely removed */
  }
  
  .puzzle-piece:hover {
    transform: scale(1.05);
    outline: 3px solid #ff7aa2; /* CHANGED from border to outline */
    box-shadow: 0 4px 10px rgba(255, 153, 204, 0.5);
  }

/* ========== Puzzle Selector (Default Dark Mode) ========== */
.puzzle-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 15px;
}

.puzzle-selector p {
    font-size: 1rem;
    color: #ffb3d9; /* Light text for dark background */
    margin-bottom: 10px;
}

.puzzle-selector-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.puzzle-selector button {
    padding: 8px 18px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    background: rgba(255, 102, 170, 0.4); /* Dark mode button style */
    color: white;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.puzzle-selector button:hover {
    transform: scale(1.05);
    background: rgba(255, 102, 170, 0.6);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#shuffle-btn {
    background: rgba(255, 102, 170, 0.6);
}

#shuffle-btn:hover {
    background: #ff66aa;
}

/* ========== Popup Styling (Default Dark Mode) ========== */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(20, 0, 20, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 2000;
}

.popup.active {
    opacity: 1;
    pointer-events: all;
}

.popup-content {
    background: linear-gradient(145deg, #5c2147, #78285f); /* Dark mode background */
    box-shadow: 0 8px 25px rgba(255, 150, 200, 0.3);
    border-radius: 20px;
    padding: 35px 25px 25px;
    max-width: 500px;
    text-align: center;
    position: relative;
}

.popup-content p {
    color: #ffe6f0; /* Light text for dark background */
    font-size: 1.1rem;
    line-height: 1.5;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    padding: 5px;
    font-size: 1.4rem;
    font-weight: bold;
    color: #ffb3d9; /* Light color for dark background */
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
}

.close-btn:hover {
    color: #ffffff;
    transform: scale(1.1);
}

.puzzle-piece:hover, .puzzle-selector button:hover, .close-btn:hover, #shuffle-btn:hover {
    cursor: url('../images/cursor/hover.png') 16 16, pointer;
}

/* ========== Dragging Styles ========== */
.puzzle-piece.dragging {
    transform: scale(1.1) rotate(3deg);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    opacity: 0.8;
    cursor: grabbing;
    z-index: 10;
}

.puzzle-piece.drag-over {
    outline: 3px solid #ff66aa;
    outline-offset: -3px;
    filter: brightness(1.1);
}

/*
==================================================================
  LIGHT MODE OVERRIDES
==================================================================
*/

body.light-mode .puzzle-selector p {
    color: #d93f7d;
}

body.light-mode .puzzle-selector button {
    background: #ffffff;
    color: #5c0033;
    box-shadow: 0 3px 8px rgba(255, 150, 190, 0.4);
}

body.light-mode #shuffle-btn {
    background: #ff99cc;
}

body.light-mode .popup-content {
    background: rgba(255, 192, 203, 0.95);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

body.light-mode .popup-content p {
    color: #800040;
}

body.light-mode .close-btn {
    color: rgba(92, 0, 51, 0.6);
}

body.light-mode .close-btn:hover {
    color: rgba(92, 0, 51, 1);
}