/* style.css */
/* This file contains all the CSS for the Dara Dice game. */

/* --- General Styles --- */
body {
    font-family: 'Merriweather', serif; /* Primary text font */
    background: linear-gradient(to bottom, #2c3e50, #34495e); /* Dark blue-grey gradient */
    background-image: url('https://daradice.com/background.jpg'); /* Placeholder for a fantasy background image */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column; /* Changed to column to allow footer at bottom */
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    color: #ecf0f1; /* Light grey text for contrast */
    padding-bottom: 60px; /* Add padding to body to prevent content from being hidden by fixed footer */
}

h1, h2, h3, h4 {
    font-family: 'Cinzel Decorative', cursive; /* Decorative font for titles */
    color: #f1c40f; /* Gold color for titles */
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Override Bootstrap's .text-muted for better visibility on dark background */
.text-muted {
    color: #7A959C !important; /* Using !important to ensure override */
}

/* --- Layout & Container Styles --- */
/* New wrapper to place game container and Dara image side-by-side */
.main-content-wrapper {
    display: flex;
    justify-content: center; /* Center the game container horizontally */
    align-items: center; /* Vertically center items */
    position: relative; /* Needed for absolute positioning of Dara image */
    max-width: 800px; /* Overall max-width for the content area */
    width: 100%;
    flex-grow: 1; /* Allow main content to grow and push footer down */
}

.game-container {
    background-color: rgba(10, 25, 40, 0.9); /* Darker, semi-transparent background */
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
    padding: 40px;
    max-width: 800px; /* Max width for the game content itself */
    width: 100%; /* Take full width within its flex item */
    border: 3px solid #f1c40f; /* Gold border */
    position: relative; /* Ensure game content is above Dara image */
    z-index: 1; /* Ensure it's above the Dara image */
}

.game-area {
    background-color: rgba(25, 45, 60, 0.8); /* Slightly lighter inner background */
    border-radius: 15px;
    padding: 30px;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
    border: 1px solid #3498db; /* Blue border */
}

.themed-section {
    background-color: rgba(10, 25, 40, 0.9); /* Darker, semi-transparent background */
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
    padding: 30px;
    border: 3px solid #f1c40f; /* Gold border */
    margin-top: 2rem;
}

.admin-section {
    background-color: rgba(25, 45, 60, 0.9); /* Slightly different shade for admin */
}

/* --- Header Styles --- */
.game-header {
    width: 100%;
    background-color: rgba(10, 25, 40, 0.9);
    border-bottom: 2px solid #f1c40f;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    padding: 10px 0;
    z-index: 100; /* Ensure header is above other content */
    flex-shrink: 0; /* Prevent header from shrinking */
}

.game-header .navbar-brand h1 {
    font-size: 2.5em; /* Adjust size as needed */
    margin: 0;
    color: #f1c40f; /* Gold color for title */
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* --- Game Specific Elements --- */
.score-display .text-player {
    color: #3498db; /* Blue for player */
}
.score-display .text-opponent {
    color: #e74c3c; /* Red for opponent */
}

.dice-display {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 15px; /* Adjusted margin */
}

.dice-face {
    width: 90px;
    height: 90px;
    background-color: #f39c12; /* Orange-gold dice */
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 55px;
    font-weight: bold;
    color: #8e44ad; /* Deep purple numbers */
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.4), 5px 5px 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease-out;
    border: 2px solid #e67e22;
}
.dice-face.rolling {
    animation: shake 0.5s infinite;
}
@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

/* Health Display */
.health-display {
    display: flex;
    justify-content: center;
    margin-top: 10px;
    min-height: 30px; /* Ensure space even if no hearts */
}
.health-display img {
    width: 24px; /* Size of heart icon */
    height: 24px;
    margin: 0 2px;
    vertical-align: middle;
}

.btn-fancy {
    background: linear-gradient(to right, #27ae60, #2ecc71); /* Green gradient for roll button */
    border: none;
    border-radius: 50px;
    padding: 12px 30px;
    font-size: 1.2em;
    font-weight: bold;
    color: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.btn-fancy:hover {
    background: linear-gradient(to right, #2ecc71, #27ae60);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
.btn-fancy:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

/* Specific styles for Victory, Loss, and Draw screens */
#victoryScreen, #lossScreen, #drawScreen {
    background-color: rgba(25, 45, 60, 0.8);
    border-radius: 15px;
    padding: 30px;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
    border: 1px solid #3498db;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#victoryScreen h2 {
    color: #2ecc71; /* Green for victory */
}

#lossScreen h2 {
    color: #e74c3c; /* Red for defeat */
}

#drawScreen h2 {
    color: #3498db; /* Blue for draw */
}

/* Gift Box animation */
.gift-box {
    cursor: pointer;
    transition: transform 0.2s ease-out;
    display: block; /* Ensure it respects margin auto */
    margin-left: auto;
    margin-right: auto;
    margin-top: 24px;
    margin-bottom: 24px;
    max-width: 150px; /* Adjusted from 180px for consistency with placeholder */
}

.gift-box:hover {
    transform: scale(1.05);
}

.gift-box.opened {
    opacity: 0.7;
    cursor: default;
}

/* Shake animation */
.gift-box.shaking {
    animation: giftbox-shake 0.7s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes giftbox-shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-8px); }
    40%, 60% { transform: translateX(8px); }
    100% { transform: none; }
}

/* In-game status message (not the modal) */
#inGameStatusMessage {
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    border-radius: 0.5rem;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background-color: rgba(25, 45, 60, 0.8); /* Match game-area background */
    color: #ecf0f1;
    border: 1px solid #3498db;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
}

/* Card collection grid: align cards left, wrap to next line, no Bootstrap row/col */
#cardCollection {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: flex-start;
    align-items: flex-start;
    min-height: 120px;
}
.card-collection-item {
    width: 150px;
    margin: 0;
    flex: 0 0 auto;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease;
    background-color: rgba(44, 62, 80, 0.9); /* Dark background for cards */
    border: 1px solid #3498db;
    color: #ecf0f1;
    cursor: pointer; /* Indicate clickable */
}
.card-collection-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
}
.card-collection-item img {
    width: 100%;
    height: 200px; /* Fixed height for consistency */
    object-fit: cover;
    border-bottom: 1px solid #3498db;
}
.card-collection-item .card-body {
    padding: 0.75rem;
    text-align: center;
    background-color: rgba(25, 45, 60, 0.8); /* Lighter background for body */
}
.card-collection-item .card-title {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
    color: #f1c40f; /* Gold title */
}
.card-collection-item .card-text {
    font-size: 0.85rem;
    color: #bdc3c7; /* Lighter grey text */
    margin-bottom: 0;
}

/* Center and single-line the no cards message */
#noCardsMessage {
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Dara image in start screen row */
.dara-image-wrapper {
    margin-right: 24px;
    margin-bottom: 0;
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
#daraImage {
    width: auto;
    max-height: 380px;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.5));
    position: static;
    z-index: auto;
}

/* Fog overlay for Dara's dice */
#daraDiceFog {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(200,200,200,0.7) url('https://daradice.com/fog.png') center center/cover repeat;
    pointer-events: none;
    z-index: 2;
    border-radius: 12px;
    display: none;
}
#opponentDice {
    position: relative;
}
.dice-face.fogged {
    filter: blur(2px) grayscale(0.7) brightness(1.2);
    opacity: 0.7;
}

/* --- Modal Styles --- */
/* Base for all modal overlays */
.message-box-overlay, .card-modal-overlay, .privacy-modal-overlay, .age-verify-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* Dark overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden; /* Hidden by default */
    opacity: 0;
    transition: visibility 0s, opacity 0.3s ease;
}
.message-box-overlay.show, .card-modal-overlay.show, .privacy-modal-overlay.show, .age-verify-overlay.show {
    visibility: visible;
    opacity: 1;
}

/* Base for all modal content boxes */
.message-box, .card-modal-content, .privacy-modal-content, .age-verify-content {
    background-color: rgba(44, 62, 80, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    border: 2px solid #f1c40f;
    color: #ecf0f1;
    text-align: center;
    position: relative;
    max-width: 400px;
    width: 90%;
    font-family: 'Merriweather', serif;
}

/* Specific overrides for different modal types */
.card-modal-overlay { z-index: 1100; }
.card-modal-content {
    border: 3px solid #f1c40f;
    padding: 20px;
    max-width: 500px;
}
.card-modal-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 2px solid #3498db;
}
.card-modal-content h3 {
    font-family: 'Cinzel Decorative', cursive;
    color: #f1c40f;
    margin-bottom: 10px;
}
.card-modal-content p {
    font-size: 1em;
    margin-bottom: 8px;
}
.card-modal-content p:last-of-type {
    margin-bottom: 0;
    font-size: 0.9em;
    color: #bdc3c7;
}

.privacy-modal-overlay { z-index: 1200; }
.privacy-modal-content {
    background-color: rgba(10, 25, 40, 0.98);
    border: 3px solid #3498db;
    padding: 30px;
    max-width: 700px;
    text-align: left;
    max-height: 90vh;
    overflow-y: auto;
}
.privacy-modal-content h2 {
    font-family: 'Cinzel Decorative', cursive;
    color: #f1c40f;
    margin-bottom: 20px;
    text-align: center;
}
.privacy-modal-content h3 {
    font-family: 'Merriweather', serif;
    color: #3498db;
    margin-top: 20px;
    margin-bottom: 10px;
}
.privacy-modal-content p {
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 10px;
}

.age-verify-overlay { z-index: 1500; }
.age-verify-content {
    background-color: rgba(44, 62, 80, 0.98);
    border: 3px solid #e74c3c;
    padding: 30px;
}
.age-verify-content h2 {
    font-family: 'Cinzel Decorative', cursive;
    color: #e74c3c;
    margin-bottom: 20px;
}
.age-verify-content p {
    font-size: 1.1em;
    margin-bottom: 15px;
}
.age-verify-content .btn-fancy {
    background: linear-gradient(to right, #e74c3c, #c0392b);
}
.age-verify-content .btn-fancy:hover {
    background: linear-gradient(to right, #c0392b, #e74c3c);
}

/* Common close button style for modals */
.card-modal-close-btn, .privacy-modal-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2em;
    color: #f1c40f;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
    transition: color 0.2s ease;
}
.card-modal-close-btn:hover, .privacy-modal-close-btn:hover {
    color: #e67e22;
}

/* --- Footer Styles --- */
.game-footer {
    width: 100vw; /* Full viewport width */
    background-color: rgba(10, 25, 40, 0.9);
    color: #ecf0f1;
    text-align: center;
    padding: 15px 20px;
    position: fixed; /* Fixed position */
    bottom: 0; /* Align to bottom */
    left: 0; /* Align to left edge */
    border-top: 2px solid #f1c40f;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
    font-size: 0.9em;
    z-index: 900; /* Ensure it's above most content but below modals */
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: center; /* Center the text within the footer content */
}

.footer-content p {
    margin: 0;
}

.footer-content a {
    color: #f1c40f;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-content a:hover {
    color: #e67e22;
}


/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    body {
        padding: 10px; /* Reduce padding for smaller screens */
        font-size: 0.9em; /* Adjust font size for readability */
    }

    .main-content-wrapper {
        flex-direction: column;
        gap: 10px; /* Add spacing between elements */
        padding: 0;
    }

    .game-container {
        padding: 15px;
        border-radius: 10px; /* Slight rounding for a cleaner look */
        box-shadow: none; /* Remove heavy shadows */
    }

    .dice-display {
        flex-direction: column;
        gap: 10px; /* Reduce gap for smaller screens */
    }

    .dice-face {
        width: 60px;
        height: 60px;
        font-size: 1.5em; /* Adjust font size for dice numbers */
    }

    .btn-fancy {
        font-size: 1em;
        padding: 10px 20px; /* Adjust button size */
    }

    #cardCollection {
        gap: 10px; /* Reduce gap between cards */
    }

    .card-collection-item {
        width: 45%; /* Adjust card width for better fit */
        max-width: 150px;
    }

    .card-collection-item img {
        height: 100px; /* Adjust image height */
    }

    .game-footer {
        position: static; /* Allow footer to flow naturally */
        padding: 10px; /* Adjust padding */
    }

    h1, h2, h3, h4 {
        font-size: 1em; /* Adjust heading sizes */
    }
}

/* Ensure consistent height to prevent layout shifts */
#startGameSection, #mainGameArea {
    min-height: 500px; /* Set a consistent minimum height */
}

/* Card reveal animation: hidden -> blurry -> in focus */
.card-modal-content img.card-reveal-anim {
    opacity: 0;
    filter: blur(16px);
    animation: card-reveal-fadein 0.5s cubic-bezier(0.4,0,0.2,1) forwards;
}
@keyframes card-reveal-fadein {
    0% {
        opacity: 0;
        filter: blur(16px);
    }
    60% {
        opacity: 1;
        filter: blur(8px);
    }
    80% {
        opacity: 1;
        filter: blur(2px);
    }
    100% {
        opacity: 1;
        filter: blur(0);
    }
}