/* public/css/septica.css */

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

body.dark-theme #septica-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);
}

#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;
}

/* ===== PLAYER CARDS ===== */
.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: #e74c3c;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.4);
    background: rgba(231, 76, 60, 0.08);
}

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

/* ===== PLAYING CARDS ===== */
.septica-card {
    width: 90px;
    height: 130px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    border: 3px solid #ccc;
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    touch-action: none;
}

.septica-card .card-value {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}

.septica-card .card-suit {
    font-size: 28px;
    line-height: 1;
    margin-top: 2px;
}

.septica-card .card-corner {
    position: absolute;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
}

.septica-card .card-corner.top-left {
    top: 5px;
    left: 6px;
}

.septica-card .card-corner.bottom-right {
    bottom: 5px;
    right: 6px;
    transform: rotate(180deg);
}

/* Suit colors */
.septica-card.hearts,
.septica-card.diamonds {
    color: #c0392b;
    border-color: #e6bcbc;
}

.septica-card.spades,
.septica-card.clubs {
    color: #2c3e50;
    border-color: #bdc3c7;
}

/* Seven cards — special golden border */
.septica-card.is-seven {
    border-color: #f39c12 !important;
    box-shadow: 0 0 12px rgba(243, 156, 18, 0.35);
}

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

.septica-card.playable {
    box-shadow: 0 0 20px rgba(26, 188, 156, 0.5) !important;
    border-color: #1abc9c !important;
    z-index: 5;
    transform: translateY(-5px) scale(1.02);
}

.septica-card.playable:hover {
    transform: translateY(-15px) scale(1.1);
    z-index: 20;
}

.septica-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;
}

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

/* Card Back */
.septica-card.back {
    background: linear-gradient(135deg, #8e1538 0%, #6b0f2a 50%, #8e1538 100%);
    background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0, rgba(255, 255, 255, 0.04) 2px, transparent 2px, transparent 8px);
    border: 3px solid #d4a373;
    color: #d4a373;
}

.septica-card.back .card-value,
.septica-card.back .card-suit,
.septica-card.back .card-corner {
    display: none;
}

.septica-card.back::after {
    content: '♠';
    font-size: 28px;
    opacity: 0.5;
}

/* ===== TRICK AREA ===== */
#trick-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
    min-height: 150px;
}

.trick-pile {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 200px;
    min-height: 130px;
    padding: 15px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.1);
    border: 2px dashed rgba(255, 255, 255, 0.15);
}

body.dark-theme .trick-pile {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.trick-pile .septica-card {
    cursor: default;
}

.trick-pile .septica-card:hover {
    transform: none;
}

.deck-remaining-badge {
    background: rgba(0, 0, 0, 0.3);
    color: #f1c40f;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* ===== HAND CONTAINER ===== */
.hand-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    padding: 30px 0;
    min-height: 160px;
}

.hand-container .septica-card {
    margin-left: -20px;
}

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

/* ===== SCORE DISPLAY ===== */
#score-display {
    flex-wrap: wrap;
}

.score-badge {
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: 12px;
    padding: 8px 18px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.score-badge.active {
    border-color: #e74c3c;
    box-shadow: 0 0 12px rgba(231, 76, 60, 0.3);
}

.score-badge .score-value {
    color: #f39c12;
    font-weight: 800;
    font-size: 1.1rem;
}

/* ===== MINI CARDS ===== */
.mini-hand-container {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    margin-top: 8px;
    max-width: 130px;
    margin-left: auto;
    margin-right: auto;
}

.mini-card {
    width: 26px;
    height: 38px;
    border-radius: 4px;
    margin-left: -10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

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

.mini-card.back {
    background: linear-gradient(135deg, #8e1538 0%, #6b0f2a 50%, #8e1538 100%);
    background-size: 100% 100%;
    border: 1.5px solid #d4a373;
    position: relative;
    overflow: hidden;
}

.mini-card.back::after {
    content: '♠';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    color: rgba(212, 163, 115, 0.4);
    pointer-events: none;
}

body.dark-theme .mini-card.back {
    background: linear-gradient(135deg, #5a0e24 0%, #3d0917 50%, #5a0e24 100%);
    border-color: #a97d52;
}

/* ===== STATUS BAR ===== */
#game-status {
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: 50px;
}

/* ===== ANIMATIONS ===== */
@keyframes cardPlay {
    from {
        transform: translateY(50px) scale(0.5);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.card-played {
    animation: cardPlay 0.4s ease-out;
}

@keyframes trickCapture {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        opacity: 0;
        transform: scale(0.3) translateY(-40px);
    }
}

.trick-captured {
    animation: trickCapture 0.6s ease-in forwards;
}

/* ===== MODAL ===== */
.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;
}

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

#universalModal,
#captured-cards-modal {
    z-index: 10000;
}

.modal-backdrop {
    z-index: 9999;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .septica-card {
        width: 65px;
        height: 95px;
        border-width: 2px;
    }

    .septica-card .card-value {
        font-size: 16px;
    }

    .septica-card .card-suit {
        font-size: 20px;
    }

    .septica-card .card-corner {
        font-size: 8px;
    }

    .hand-container .septica-card {
        margin-left: -12px;
    }

    .trick-pile {
        gap: 5px;
        padding: 10px;
        min-width: 150px;
    }

    .mini-card {
        width: 22px;
        height: 32px;
        margin-left: -8px;
        border-radius: 3px;
    }

    .mini-card.back::after {
        font-size: 11px;
    }

    .player-slot {
        transform: none !important;
    }

    .mini-hand-container {
        max-width: 110px;
        overflow: hidden;
    }

    .captured-pile-container {
        position: static !important;
        transform: none !important;
        width: auto !important;
        height: auto !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        margin-top: 4px;
        z-index: 1;
    }

    .captured-pile {
        width: 50px;
        height: 40px;
    }

    .captured-card-back {
        width: 28px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .septica-card {
        width: 55px;
        height: 80px;
    }

    .septica-card .card-value {
        font-size: 14px;
    }

    .septica-card .card-suit {
        font-size: 16px;
    }

    .player-card {
        padding: 8px 5px;
        border-radius: 10px;
    }

    .player-card h6 {
        font-size: 0.8rem;
        margin-bottom: 2px !important;
    }

    .mini-hand-container {
        max-width: 80px;
        overflow: hidden;
    }

    .mini-card {
        width: 18px;
        height: 26px;
        margin-left: -6px;
        border-radius: 2px;
    }

    .mini-card.back::after {
        font-size: 9px;
    }
}

/* Captured Pile Styles (previously added) */
/* Captured Pile Styles - Fanned "Rainbow" Look */
.captured-pile-container {
    display: none; /* Hidden by default as we use the inline badge widget now */
}

/* New Inline Widget for Score Badges */
.captured-badge-widget {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 20px;
    width: 100%;
}

.captured-pile-inline {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 5px 0;
}

.captured-pile-inline.show-fan {
    height: 55px; /* More space when fanned */
}

.captured-badge-count {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

.captured-card-back {
    position: absolute;
    width: 35px;
    height: 50px;
    background: linear-gradient(135deg, #8e0e00, #1f1c18);
    border: 1.5px solid #ffd700;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: bottom center;
}

.captured-card-back::after {
    content: "♠";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 215, 0, 0.4);
    font-size: 12px;
}

.score-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    min-width: 120px;
}

.score-badge.active {
    background: rgba(40, 167, 69, 0.2);
    border-color: rgba(40, 167, 69, 0.5);
    box-shadow: 0 0 15px rgba(40, 167, 69, 0.2);
}

.score-value {
    font-size: 1.25rem;
    font-weight: bold;
    color: #ffd700;
}

/* Modal History Styles */
.extra-small {
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}


/* Deck Pile Styles */
.deck-pile {
    position: absolute;
    top: 50%;
    left: -100px;
    /* Positioned to the left of the trick pile */
    transform: translateY(-50%);
    width: 70px;
    height: 100px;
    pointer-events: none;
}

.deck-card-back {
    position: absolute;
    width: 70px;
    height: 100px;
    border-radius: 6px;
    background: linear-gradient(135deg, #232526, #414345);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

/* Red-themed back for the deck to distinguish from other elements */
.deck-card-back {
    background: linear-gradient(135deg, #8e0e00, #1f1c18);
    background-size: cover;
    border: 2px solid #ffd700;
}

.deck-count {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #ffd700;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    border: 1px solid #ffd700;
    text-shadow: 1px 1px 2px black;
}