/* public/css/soliter.css */

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

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

/* ===== SETUP SCREEN ===== */
#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;
}

body.dark-theme #setup-screen .form-check-input {
    background-color: rgba(33, 37, 41, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ===== PLAYING CARDS ===== */
.soliter-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;
    box-sizing: border-box;
}

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

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

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

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

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

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

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

.soliter-card:hover {
    z-index: 10;
}

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

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

/* Card Back */
.soliter-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;
    cursor: default;
}

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

.soliter-card.back::after {
    content: '\2660';
    font-size: 28px;
    opacity: 0.5;
}

/* ===== TOP BAR ===== */
#soliter-top-bar {
    margin-bottom: 15px;
}

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

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

/* ===== TOP ROW: Stock/Waste + Foundations ===== */
#top-row {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#stock-waste-area {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

#foundation-row {
    display: flex;
    gap: 10px;
}

/* ===== PILE PLACEHOLDERS ===== */
.pile-placeholder {
    width: 90px;
    height: 130px;
    border-radius: 10px;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
}

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

.pile-icon {
    font-size: 24px;
    opacity: 0.3;
    color: var(--text-color);
}

.pile-suit-icon {
    font-size: 32px;
    opacity: 0.2;
}

.foundation-pile[data-index="0"] .pile-suit-icon,
.foundation-pile[data-index="1"] .pile-suit-icon {
    color: #c0392b;
}

.foundation-pile[data-index="2"] .pile-suit-icon,
.foundation-pile[data-index="3"] .pile-suit-icon {
    color: #2c3e50;
}

body.dark-theme .foundation-pile[data-index="2"] .pile-suit-icon,
body.dark-theme .foundation-pile[data-index="3"] .pile-suit-icon {
    color: #bdc3c7;
}

#stock-pile {
    cursor: pointer;
    transition: transform 0.2s;
}

#stock-pile:hover {
    transform: scale(1.05);
}

#stock-pile.has-cards {
    border: none;
    background: none;
}

/* ===== WASTE PILE ===== */
#waste-pile {
    position: relative;
    min-width: 90px;
    border: none;
    background: none;
}

#waste-pile.empty {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.05);
}

.waste-card {
    position: absolute;
    top: 0;
}

/* ===== FOUNDATION PILES ===== */
.foundation-pile {
    transition: box-shadow 0.3s ease;
}

.foundation-pile.highlight {
    box-shadow: 0 0 20px rgba(39, 174, 96, 0.6);
    border-color: #27ae60 !important;
}

.foundation-pile .soliter-card {
    position: absolute;
    top: 0;
    left: 0;
}

/* ===== TABLEAU ===== */
#tableau-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.tableau-column {
    position: relative;
    min-height: 180px;
    width: 90px;
}

.tableau-column.empty-col {
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    min-height: 130px;
}

body.dark-theme .tableau-column.empty-col {
    border-color: rgba(255, 255, 255, 0.06);
}

.tableau-column .soliter-card {
    position: absolute;
    left: 0;
}

.tableau-column.highlight-col {
    background: rgba(39, 174, 96, 0.1);
    border-radius: 10px;
    border: 2px dashed rgba(39, 174, 96, 0.4);
}

/* ===== DRAG GROUP ===== */
.drag-group {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
}

.drag-group .soliter-card {
    position: absolute;
    left: 0;
    pointer-events: none;
}

/* ===== AUTO COMPLETE ===== */
#auto-complete-container .btn {
    animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(39, 174, 96, 0.3); }
    50% { box-shadow: 0 0 25px rgba(39, 174, 96, 0.7); }
}

/* ===== DEAL ANIMATION ===== */
.soliter-card.dealing {
    animation: cardDeal 0.3s ease-out forwards;
}

@keyframes cardDeal {
    from {
        opacity: 0;
        transform: translate(-100px, -80px) scale(0.5) rotate(-15deg);
    }
    to {
        opacity: 1;
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
}

/* ===== FLIP ANIMATION ===== */
.soliter-card.flipping {
    animation: cardFlip 0.4s ease-in-out;
}

@keyframes cardFlip {
    0% { transform: scaleX(1); }
    50% { transform: scaleX(0); }
    100% { transform: scaleX(1); }
}

/* ===== WIN ANIMATION ===== */
.soliter-card.win-cascade {
    animation: winCascade 1.5s ease-in forwards;
}

@keyframes winCascade {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    50% { transform: translateY(-100px) rotate(180deg); opacity: 0.8; }
    100% { transform: translateY(600px) rotate(360deg); opacity: 0; }
}

/* ===== GAME STATUS ===== */
#game-status {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-color);
}

body.dark-theme #game-status {
    background: rgba(33, 37, 41, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* ===== RECYCLE ICON ON EMPTY STOCK ===== */
#stock-pile.empty-stock {
    cursor: pointer;
}

#stock-pile.empty-stock .pile-icon {
    opacity: 0.5;
}

/* ===== RESPONSIVE: TABLET ===== */
@media (max-width: 768px) {
    #soliter-section {
        padding-top: 80px;
    }

    .soliter-card {
        width: 65px;
        height: 95px;
        border-width: 2px;
        border-radius: 8px;
    }

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

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

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

    .soliter-card .card-corner.top-left {
        top: 3px;
        left: 4px;
    }

    .soliter-card .card-corner.bottom-right {
        bottom: 3px;
        right: 4px;
    }

    .soliter-card.back::after {
        font-size: 20px;
    }

    .pile-placeholder {
        width: 65px;
        height: 95px;
    }

    .pile-suit-icon {
        font-size: 24px;
    }

    .tableau-column {
        width: 65px;
        min-height: 120px;
    }

    .tableau-column.empty-col {
        min-height: 95px;
    }

    #tableau-row {
        gap: 5px;
    }

    #top-row {
        gap: 12px;
    }

    #stock-waste-area,
    #foundation-row {
        gap: 6px;
    }

    .score-badge {
        padding: 5px 12px;
        font-size: 0.8rem;
    }

    #waste-pile {
        min-width: 65px;
    }
}

/* ===== RESPONSIVE: MOBILE ===== */
@media (max-width: 480px) {
    #soliter-section {
        padding-top: 70px;
    }

    .soliter-card {
        width: 48px;
        height: 70px;
        border-radius: 6px;
        border-width: 2px;
    }

    .soliter-card .card-value {
        font-size: 13px;
    }

    .soliter-card .card-suit {
        font-size: 15px;
    }

    .soliter-card .card-corner {
        font-size: 7px;
    }

    .soliter-card .card-corner.top-left {
        top: 2px;
        left: 3px;
    }

    .soliter-card .card-corner.bottom-right {
        bottom: 2px;
        right: 3px;
    }

    .soliter-card.back::after {
        font-size: 15px;
    }

    .pile-placeholder {
        width: 48px;
        height: 70px;
    }

    .pile-suit-icon {
        font-size: 18px;
    }

    .pile-icon {
        font-size: 16px;
    }

    .tableau-column {
        width: 48px;
        min-height: 90px;
    }

    .tableau-column.empty-col {
        min-height: 70px;
    }

    #tableau-row {
        gap: 3px;
    }

    #top-row {
        gap: 8px;
    }

    #stock-waste-area,
    #foundation-row {
        gap: 4px;
    }

    .score-badge {
        padding: 4px 8px;
        font-size: 0.7rem;
    }

    #waste-pile {
        min-width: 48px;
    }

    #soliter-top-bar {
        gap: 4px !important;
    }

    #soliter-top-bar .btn {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
}
