/* public/css/una.css */

#una-section {
    min-height: 80vh;
    background-color: var(--section-bg);
    color: var(--text-color);
    padding-top: 100px;
}

body.dark-theme #una-section {
    background: radial-gradient(circle at center, #1a252f 0%, #000000 100%);
}

#setup-screen .card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    backdrop-filter: blur(10px);
}

.player-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    border: 2px solid var(--card-border);
    color: var(--text-color);
}

.player-card-count {
    color: var(--secondary-text-color);
}

body.dark-theme .player-card-count {
    color: rgba(255, 255, 255, 0.5);
}

.player-card.active {
    border-color: #1abc9c;
    box-shadow: 0 0 15px rgba(26, 188, 156, 0.4);
    background: rgba(26, 188, 156, 0.1);
}

#setup-screen .form-select,
#setup-screen .form-control {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--input-text);
}

body.dark-theme #setup-screen .form-select,
body.dark-theme #setup-screen .form-control {
    background-color: rgba(33, 37, 41, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

#deck-area {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 20px 0;
}

/* Una Card Styling */
.una-card {
    width: 100px;
    height: 150px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border: 4px solid white;
    touch-action: none; /* Prevent scrolling while dragging */
}

.una-card.dragging {
    z-index: 9999 !important;
    opacity: 0.9;
    box-shadow: 0 15px 30px rgba(0,0,0,0.5);
    transition: none !important;
    pointer-events: none; /* Allow detecting elements below */
}

.una-card.snap-back {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

/* Discard Stack Visuals */
#discard-pile {
    position: relative;
    min-width: 100px;
    min-height: 150px;
}

.discard-stack-card {
    position: absolute !important;
    top: 0;
    left: 0;
    z-index: 1;
}

#discard-pile .una-card:last-child {
    position: relative;
    z-index: 10;
}

.una-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.una-card.back {
    background-color: #2c3e50;
    background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0, rgba(255, 255, 255, 0.05) 2px, transparent 2px, transparent 10px);
    border: 4px solid white;
}

.una-card.back span {
    background: white;
    color: #e74c3c;
    width: 80%;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transform: rotate(-20deg);
    font-weight: 900;
    font-size: 24px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Card Colors */
.una-card.red {
    background-color: #e74c3c;
}

.una-card.blue {
    background-color: #3498db;
}

.una-card.green {
    background-color: #2ecc71;
}

.una-card.yellow {
    background-color: #f1c40f;
    color: #2c3e50;
}

.una-card.wild {
    background: linear-gradient(45deg, #e74c3c, #3498db, #2ecc71, #f1c40f);
}

/* Hand Container */
.hand-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: -20px;
    /* Overlap cards */
    padding: 40px 0;
    min-height: 200px;
}

.hand-container .una-card {
    margin-left: -30px;
}

.hand-container .una-card:first-child {
    margin-left: 0;
}

.hand-container .una-card.playable {
    box-shadow: 0 0 25px var(--button-bg) !important;
    border-color: var(--button-bg) !important;
    z-index: 5;
    transform: translateY(-5px) scale(1.02);
}

/* Ensure the hover still works but keeps the playable state prominent */
.hand-container .una-card.playable:hover {
    transform: translateY(-15px) scale(1.1);
    z-index: 20;
}

#game-status {
    font-size: 1.2rem;
    font-weight: 500;
    border-radius: 50px;
}

/* Mini Cards for Opponents */
.mini-hand-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: -15px;
    margin-top: 10px;
    max-width: 150px;
    margin-left: auto;
    margin-right: auto;
}

.mini-card {
    width: 30px;
    height: 45px;
    border-radius: 4px;
    border: 1px solid white;
    margin-left: -15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.mini-card:first-child {
    margin-left: 0;
}

.mini-card.back {
    background-color: #2c3e50;
    background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0, rgba(255, 255, 255, 0.05) 1px, transparent 1px, transparent 5px);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border: 1px solid white;
}

body.dark-theme .mini-card.back {
    background-color: #1a252f;
}

.mini-card.back::after {
    content: 'UNA';
    background: white;
    color: #e74c3c;
    font-size: 8px;
    font-weight: 900;
    width: 85%;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transform: rotate(-20deg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Animations */
@keyframes drawCard {
    from {
        transform: translate(-100px, -100px) rotate(-45deg);
        opacity: 0;
    }

    to {
        transform: translate(0, 0) rotate(0);
        opacity: 1;
    }
}

.draw-animation {
    animation: drawCard 0.5s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
    .una-card {
        width: 70px;
        height: 105px;
        font-size: 18px;
        border-width: 2px;
    }

    .hand-container .una-card {
        margin-left: -15px;
    }
}

/* Color Modal Buttons - Specific overrides to avoid styles.css global !important */
.color-btn[data-color="red"] {
    background-color: #e74c3c !important;
    border-color: #e74c3c !important;
    color: white !important;
}

.color-btn[data-color="blue"] {
    background-color: #3498db !important;
    border-color: #3498db !important;
    color: white !important;
}

.color-btn[data-color="green"] {
    background-color: #2ecc71 !important;
    border-color: #2ecc71 !important;
    color: white !important;
}

.color-btn[data-color="yellow"] {
    background-color: #f1c40f !important;
    border-color: #f1c40f !important;
    color: #2c3e50 !important;
}

.reverse-active {
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.5);
    border: 1px solid #e74c3c;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

.modal-content {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--card-border) !important;
}

.modal-header, .modal-footer {
    border-color: var(--card-border) !important;
}

.modal-header .btn-close {
    filter: var(--close-btn-filter, none);
}

body.dark-theme .modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

#players-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

#players-row .col {
    flex: 0 0 auto;
    width: 180px;
    /* Base width for player cards */
}

@media (max-width: 768px) {
    #players-row .col {
        width: 140px;
    }
}

/* Extra Small Screens: Condense players even more */
@media (max-width: 480px) {
    #players-row .col {
        width: 100px;
    }
    .player-card {
        padding: 8px 5px;
        border-radius: 10px;
    }
    .player-card h6 {
        font-size: 0.8rem;
        margin-bottom: 2px !important;
    }
    .player-card-count {
        font-size: 0.65rem;
    }
    .mini-hand-container {
        gap: -10px;
        max-width: 80px;
    }
    .mini-card {
        width: 20px;
        height: 30px;
        margin-left: -10px;
    }
    .mini-card.back::after {
        font-size: 5px;
        height: 10px;
    }
}

/* History Mobile Focus Style */
.fan-card.focused {
    transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(1.4) !important;
    z-index: 12000 !important;
    box-shadow: 0 15px 35px rgba(255, 215, 0, 0.6);
    filter: brightness(1.2);
    border-color: #f1c40f !important;
}

/* Suggestion Glow: Gold pulse for deck when no moves */
.suggestion-glow {
    animation: draw-pile-glow 1.5s infinite alternate;
    border-color: #f1c40f !important;
    position: relative;
    z-index: 100;
}

@keyframes draw-pile-glow {
    from {
        box-shadow: 0 0 10px rgba(241, 196, 15, 0.4);
    }
    to {
        box-shadow: 0 0 35px rgba(241, 196, 15, 0.9);
        transform: scale(1.02);
    }
}
