/* ================================================================
   Base Styles
   ================================================================ */

body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1c3f5f, #2c5f8f);
    color: #f0f0f0;
    font-family: 'Arial', sans-serif;
}

/* ================================================================
   Game Container
   ================================================================ */

#game-container {
    width: 100%;
    max-width: 1200px;
    padding: 30px;
    box-sizing: border-box;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: auto;
}

/* ================================================================
   Control Panel
   ================================================================ */

#controls {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 20px;
    margin-bottom: 20px;
}

#timer, #score {
    font-size: 18px;
    font-weight: bold;
    color: white;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 5px 10px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

button {
    padding: 12px 24px;
    font-size: 16px;
    cursor: pointer;
    background-color: #1abc9c;
    color: white;
    border: none;
    border-radius: 5px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
    box-shadow: 0 7px 10px rgba(0, 0, 0, 0.2);
}

button:hover {
    background-color: #16a085;
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}
#give-up {
    background-color: #e74c3c;
}

#give-up:hover {
    background-color: #c0392b;
}
/* ================================================================
   Game Area
   ================================================================ */

#gameArea {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

#top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 20px;
}

#stockWaste {
    display: flex;
    gap: 15px;
}

#foundations {
    display: flex;
    gap: 15px;
}

/* Ensure stock and waste piles are visible */
#stock, #waste, .foundation-slot {
    width: 120px;
    height: 168px;
    background-color: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#waste::after {
    content: 'Waste';
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Adjust foundation slots */
.foundation-slot {
    width: 120px;
    height: 168px;
    background-color: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ================================================================
   Card Slots and Piles
   ================================================================ */

.card-slot, .foundation-slot, .tableau-pile {
    width: 120px;
    height: 168px;
    background-color: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#tableau {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    width: 100%;
    flex-grow: 1;
}

.tableau-pile {
    position: relative;
    width: 120px;
    background: none;
    border: none;
    box-shadow: none;
    flex-grow: 1;
    min-height: 400px;
}

/* ================================================================
   Card Styles
   ================================================================ */

.card {
    width: 100px;
    height: 150px;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    position: absolute;
    background-repeat: no-repeat;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

.card.face-down {
    background-image: url('https://deckofcardsapi.com/static/img/back.png') !important;
}

.card.face-up {
    background-color: white;
}

/* ================================================================
   Responsive Design
   ================================================================ */

@media (max-width: 1200px) {
    .card-slot, .foundation-slot, .tableau-pile, .card {
        width: 100px;
        height: 140px;
    }

    .tableau-pile {
        min-height: 350px;
    }
}

@media (max-width: 900px) {
    .card-slot, .foundation-slot, .tableau-pile, .card {
        width: 80px;
        height: 112px;
    }

    .tableau-pile {
        min-height: 300px;
    }
}

@media (max-width: 600px) {
    #game-container {
        padding: 10px;
        border-radius: 10px;
    }

    #top-row {
        flex-wrap: nowrap;
        justify-content: space-between;
        margin-bottom: 20px;
    }

    #stockWaste {
        flex-grow: 0;
    }

    #controls {
        flex-direction: column;
        align-items: flex-end;
        margin: 0;
        gap: 10px;
    }

    #timer, #score {
        font-size: 16px;
        padding: 5px 10px;
        margin: 0;
    }

    #foundations {
        width: auto;
        justify-content: flex-end;
        margin-top: 10px;
        gap: 5px;
    }

    .card-slot, .foundation-slot, .tableau-pile, .card {
        width: 60px;
        height: 84px;
        border-radius: 5px;
    }
    .progressBar {
        max-width: 100%;
        width: 100%;
        margin: 10px 0;
    }
    .tableau-pile {
        min-height: 250px;
        margin-right: 5px;
        flex-grow: 1;
    }
    #stock, #waste, .foundation-slot, .card-slot, .tableau-pile, .card {
        width: 60px;
        height: 84px;
        border-radius: 5px;
    }

    #controls {
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 10px;
    }

    button {
        padding: 10px 20px;
        font-size: 14px;
        border-radius: 3px;
    }

    #timer, #score {
        font-size: 20px;
        padding: 8px 16px;
    }
    #progressBars {
        flex-direction: column;
        align-items: stretch;
    }
    .card.face-down, .card.face-up {
        background-size: contain;
    }
}

@media (max-width: 768px) {
    #top-row {
        flex-direction: column;
        align-items: center;
    }

    #stockWaste, #foundations {
        width: 100%;
        justify-content: center;
        margin-bottom: 20px;
    }

    #controls {
        flex-direction: column;
        align-items: center;
    }

    #timer, #score {
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    #stockWaste, #controls {
        width: 100%;
    }

    #controls {
        flex-direction: row;
        justify-content: space-between;
        margin-top: 10px;
    }
}

/* ================================================================
   Dialog Styles
   ================================================================ */

#custom-dialog {
    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;
}

#custom-dialog.hidden {
    display: none;
}

.dialog-content {
    background: linear-gradient(135deg, #2c5f8f, #1c3f5f);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    text-align: center;
    max-width: 80%;
    color: white;
}

#dialog-title {
    font-size: 24px;
    margin-bottom: 15px;
}

#dialog-message {
    font-size: 18px;
    margin-bottom: 20px;
}

#dialog-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

#dialog-yes, #dialog-no, #dialog-close {
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    transition: all 0.3s ease;
    display: inline-block;
}

#dialog-yes:hover, #dialog-no:hover, #dialog-close:hover {
    background-color: #c0392b;
}

@media (max-width: 600px) {
    #custom-dialog {
        padding: 20px;
    }

    .dialog-content {
        padding: 20px;
        border-radius: 10px;
    }

    #dialog-title {
        font-size: 20px;
    }

    #dialog-message {
        font-size: 16px;
    }

    #dialog-buttons {
        flex-direction: column;
        gap: 5px;
    }

    #dialog-yes, #dialog-no, #dialog-close {
        padding: 8px 16px;
        font-size: 14px;
    }
}
/* ================================================================
   Progress Bars
   ================================================================ */

   #progressBars {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    padding: 20px 20px 30px; /* Increased bottom padding */
}

.progressBar {
    flex: 1;
    margin: 0 10px;
    max-width: calc(50% - 20px);
    width: calc(50% - 20px); /* Added to ensure proper sizing */
}

.progressBar span {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: #f0f0f0;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 14px;
}

.progress {
    height: 25px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 12.5px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
    width: 100%;
}


#localPlayerProgress,
#opponentPlayerProgress {
    width: 0;
    height: 100%;
    transition: width 0.5s ease-in-out;
    position: relative;
    overflow: hidden;
}

#localPlayerProgress {
    background: linear-gradient(90deg, #2ecc71, #27ae60);
}

#opponentPlayerProgress {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

#localPlayerProgress::after,
#opponentPlayerProgress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
    background-size: 30px 30px;
    animation: moveStripes 1s linear infinite;
    z-index: 0;
}

@keyframes moveStripes {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 30px 0;
    }
}
/* ================================================================
   Lobby Input
   ================================================================ */

   #lobby {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  }
  
  #lobby h1 {
    text-align: center;
    color: #fff;
    margin-bottom: 30px;
  }
  
  .lobby-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  
  .lobby-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  
  .invite-code-container {
    display: flex;
    gap: 10px;
  }
  
  .invite-code-buttons {
    display: flex;
    gap: 5px;
  }
  
  .primary-button, .secondary-button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s, transform 0.1s;
  }
  
  .primary-button {
    background-color: #3498db;
    color: white;
  }
  
  .primary-button:hover {
    background-color: #2980b9;
  }
  
  .secondary-button {
    background-color: #95a5a6;
    color: white;
  }
  
  .secondary-button:hover {
    background-color: #7f8c8d;
  }
  
  .primary-button:active, .secondary-button:active {
    transform: scale(0.98);
  }
  
  .join-lobby-textbox {
    flex-grow: 1;
    padding: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 16px;
  }
  
  .join-lobby-textbox:focus {
    outline: none;
    border-color: #3498db;
  }
  
  .status-message {
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    color: #fff;
    text-align: center;
  }
  
  @media (max-width: 480px) {
    .invite-code-container {
      flex-direction: column;
    }
    
    .invite-code-buttons {
      justify-content: space-between;
    }
  }