/* Custom styles for Nads Sheepshead game */

/* Game Container with Sidebar Layout */
.game-container-with-sidebar {
    display: flex;
    min-height: 100vh;
    gap: 0;
}

.game-sidebar {
    width: 280px;
    min-width: 280px;
    background: rgba(0, 0, 0, 0.8);
    border-right: 2px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    overflow-y: auto;
    position: fixed;
    left: 0;
    top: 60px; /* Account for navbar */
    bottom: 0;
    z-index: 1000;
}

.main-game-area {
    flex: 1;
    margin-left: 280px;
    padding: 20px;
    min-height: calc(100vh - 60px);
}

.sidebar-header {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 12px;
    text-align: center;
}

.sidebar-header h6 {
    color: #ffd700;
    font-weight: bold;
    margin: 0;
}

.current-player-info {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
}

.player-nameplate-info .player-name {
    font-size: 16px;
    font-weight: bold;
    color: #ffd700;
    text-align: center;
    margin-bottom: 8px;
    padding: 6px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.player-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    padding: 3px 0;
}

.score-display, .card-count {
    font-weight: bold;
    color: #fff;
    background: rgba(0, 123, 255, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 40px;
    text-align: center;
}

.sidebar-divider {
    border-color: rgba(255, 255, 255, 0.2);
    margin: 12px 0;
}

.game-players-summary h6 {
    color: #ffd700;
    margin-bottom: 8px;
    font-size: 14px;
}

.players-list {
    /* Remove height restriction to show all players without scrolling */
}

.sidebar-player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    margin-bottom: 3px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border-left: 3px solid transparent;
}

.sidebar-player-item.current-player {
    border-left-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

.sidebar-player-name {
    font-weight: 500;
    color: #fff;
    font-size: 13px;
}

.sidebar-player-score {
    font-weight: bold;
    color: #28a745;
    background: rgba(40, 167, 69, 0.2);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.game-status-info h6 {
    color: #ffd700;
    margin-bottom: 6px;
    font-size: 14px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    padding: 3px 0;
}

.status-item small {
    font-weight: 500;
    color: #fff;
    font-size: 13px;
}

.status-value {
    font-weight: 500;
    color: #fff;
    background: rgba(108, 117, 125, 0.3);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 13px;
}

/* Responsive sidebar */
@media (max-width: 992px) {
    .game-sidebar {
        width: 240px;
        min-width: 240px;
    }
    
    .main-game-area {
        margin-left: 240px;
    }
}

@media (max-width: 768px) {
    .game-container-with-sidebar {
        flex-direction: column;
    }
    
    .game-sidebar {
        position: relative;
        width: 100%;
        min-width: auto;
        top: 0;
        padding: 15px;
        max-height: 200px;
        overflow-y: auto;
    }
    
    .main-game-area {
        margin-left: 0;
        padding: 15px;
    }
}

/* Bold red lightning bolt in navbar */
.navbar-brand .fa-bolt {
    font-weight: 900;
    text-shadow: 0 0 5px rgba(220, 53, 69, 0.8);
}

/* Double the size of the navbar brand text */
.navbar-brand {
    font-size: 2rem !important;
    font-weight: bold;
}

.card-game {
    width: 120px;  /* Increased by 25% from 96px */
    height: 168px; /* Increased by 25% from 134px */
    border-radius: 8px;
    border: 2px solid #dee2e6;
    background: white;
    color: black;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    font-size: 12px;
    font-weight: bold;
    overflow: hidden;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.card-game:hover {
    transform: translateY(-5px);
    border-color: var(--bs-primary);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.card-game.selected {
    transform: translateY(-10px);
    border-color: var(--bs-warning);
    background: #fff3cd;
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.card-game.trump {
    background: linear-gradient(135deg, #ffe4b5 0%, #ffd700 100%);
    border-color: #ffd700;
}

.card-game.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.card-game.disabled:hover {
    transform: none;
    border-color: #dee2e6;
    box-shadow: none;
}

.card-game.new-card {
    border-color: #007bff;
    background: #cce7ff;
    box-shadow: 0 0 15px rgba(0, 123, 255, 0.5);
}

.card-game.restricted {
    border-color: #dc3545;
    background: #f8d7da;
    opacity: 0.7;
    cursor: not-allowed;
}

.card-game.restricted:hover {
    transform: none;
    border-color: #dc3545;
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.3);
}

/* Force hide bidding actions when needed */
#biddingActions.d-none {
    display: none !important;
    visibility: hidden !important;
}

.card-suit {
    font-size: 16px;
    line-height: 1;
}

.card-rank {
    font-size: 14px;
    font-weight: bold;
}

.suit-hearts, .suit-diamonds {
    color: #dc3545;
}

.suit-clubs, .suit-spades {
    color: #212529;
}

/* Trick display - make all cards same size, increased by 25% */
.trick-card {
    width: 120px;  /* Increased by 25% from 96px */
    height: 168px; /* Increased by 25% from 134px */
    font-size: 12px;
}

.trick-card .card-rank {
    font-size: 14px;
}

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

.trick-card .card-image {
    width: 100%;
    height: 100%;
}

/* Player indicators */
.player-item {
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 5px;
    background: var(--bs-gray-800);
    border: 1px solid var(--bs-gray-700);
}

.player-item.current-player {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: white;
}

.player-item.picker {
    background: var(--bs-warning);
    color: black;
    border-color: var(--bs-warning);
}

/* Game status indicators */
.phase-waiting {
    color: var(--bs-info);
}

.phase-bidding {
    color: var(--bs-warning);
}

.phase-picking {
    color: var(--bs-warning);
}

.phase-playing {
    color: var(--bs-success);
}

.phase-scoring {
    color: var(--bs-primary);
}

/* Card animations */
@keyframes cardPlay {
    0% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-20px) scale(1.1);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

/* Played cards are 25% larger */
.played-card-final {
    transform: scale(1.25) !important;
    z-index: 200;
}

.card-playing {
    animation: cardPlay 0.5s ease-in-out;
}

/* Trump card enhancement for SVG images */
.card-game.trump {
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

.card-game.trump .card-image {
    filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.8));
}

/* Better visual feedback for selected cards */
.card-game.selected {
    transform: translateY(-15px);
    border-color: #ffc107;
    box-shadow: 0 8px 16px rgba(255, 193, 7, 0.5);
}

.card-game.selected .card-image {
    filter: brightness(1.1) drop-shadow(0 0 5px rgba(255, 193, 7, 0.8));
}

/* Responsive design */
@media (max-width: 768px) {
    .card-game {
        width: 90px;  /* Increased by 25% from 72px */
        height: 126px; /* Increased by 25% from 101px */
        font-size: 10px;
        padding: 3px;
        border-radius: 5px;
        border-width: 1px;
    }
    
    .card-rank {
        font-size: 18px;
    }
    
    .card-suit {
        font-size: 22px;
    }
    
    .trick-card {
        width: 150px; /* Increased by 25% from 120px */
        height: 210px; /* Increased by 25% from 168px */
        font-size: 14px;
    }
    
    .trick-card .card-rank {
        font-size: 18px;
    }
    
    .trick-card .card-suit {
        font-size: 22px;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--bs-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Hand organization */
.hand-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    min-height: 240px;
    align-items: flex-start;
}

/* Custom Tooltip Styles */
.custom-tooltip {
    position: relative !important;
    display: inline-block !important;
}

.custom-tooltip .tooltip-text {
    visibility: hidden !important;
    width: 220px !important;
    background-color: #333 !important;
    color: #fff !important;
    text-align: center !important;
    border-radius: 6px !important;
    padding: 10px !important;
    position: absolute !important;
    z-index: 10000 !important;
    bottom: 130% !important;
    left: 50% !important;
    margin-left: -110px !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
    font-size: 13px !important;
    font-weight: normal !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
    pointer-events: none !important;
    white-space: nowrap !important;
}

.custom-tooltip .tooltip-text::after {
    content: "" !important;
    position: absolute !important;
    top: 100% !important;
    left: 50% !important;
    margin-left: -5px !important;
    border-width: 5px !important;
    border-style: solid !important;
    border-color: #333 transparent transparent transparent !important;
}

.custom-tooltip:hover .tooltip-text {
    visibility: visible !important;
    opacity: 1 !important;
}

/* Force tooltips to show even on disabled buttons */
.btn:disabled.custom-tooltip:hover .tooltip-text {
    visibility: visible !important;
    opacity: 1 !important;
}

/* Score display */
.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid var(--bs-gray-700);
}

.score-item:last-child {
    border-bottom: none;
}

.score-value {
    font-weight: bold;
    color: var(--bs-success);
}

.score-value.negative {
    color: var(--bs-danger);
}

/* Bot thinking indicator */
.thinking-indicator {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    100% {
        opacity: 0.6;
        transform: scale(1);
    }
}

/* Bot player styling */
.player-item .fa-robot {
    color: var(--bs-info);
}

.player-item .fa-brain {
    animation: thinking 2s ease-in-out infinite;
}

@keyframes thinking {
    0%, 100% {
        color: #ffc107;
    }
    50% {
        color: #fd7e14;
    }
}

/* Game Table Layout */
.game-table {
    height: 80vh;
    position: relative;
    background: linear-gradient(135deg, #1e4d3a 0%, #2d6a4f 50%, #1e4d3a 100%);
    border-radius: 20px;
    border: 3px solid #40916c;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

/* Player Positions */
.player-position {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 180px;
}

.player-nameplate {
    background: linear-gradient(135deg, #2d6a4f, #40916c);
    color: white;
    padding: 12px 24px; /* Increased by 50% from 8px 16px */
    border-radius: 30px; /* Increased by 50% from 20px */
    font-weight: bold;
    font-size: 1.275rem; /* Match player score font size */
    text-align: center;
    margin-bottom: 12px; /* Increased by 50% from 8px */
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); /* Increased by 50% from 0 4px 12px */
    border: 3px solid #52b788; /* Increased by 50% from 2px */
    min-width: 180px; /* Increased by 50% from 120px */
}

.player-nameplate.current-turn {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: black;
    border-color: #ffb700;
    animation: currentPlayerGlow 2s ease-in-out infinite;
}

.player-nameplate.picker {
    background: linear-gradient(135deg, #dc3545, #c82333);
    border-color: #dc3545;
}

@keyframes currentPlayerGlow {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(255, 193, 7, 0.5);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 193, 7, 0.8);
    }
}

.player-score {
    font-size: 1.275rem; /* Increased by 50% from 0.85rem */
    color: rgba(255, 255, 255, 0.9);
}

/* Called ace indicator */
.called-ace {
    font-size: 1.1em;
    font-weight: bold;
    color: #ffc107;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    margin-left: 4px;
}

.player-card-area {
    margin-top: 10px;
    min-height: 120px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Position Layouts */
.top-players-full {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px;
    width: 100%;
    min-height: 120px;
    gap: 15px;
}

.top-bot-1, .top-bot-2, .top-bot-3, .top-bot-4 {
    flex: 1;
    max-width: 220px;
    min-width: 180px;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    opacity: 1 !important;
    visibility: visible !important;
    position: relative;
    z-index: 10;
}

/* Human player nameplate removed - info now shown in sidebar */

/* Center Area */
.center-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-top: 20px;
}

.game-actions {
    position: absolute;
    top: 2px; /* Moved down by 0.5 inch (36px) from -34px */
    background: rgba(0, 0, 0, 0.8);
    padding: 30px; /* Doubled from 15px */
    border-radius: 20px; /* Doubled from 10px */
    color: white;
    z-index: 150; /* Above hand cards */
}

/* Bidding actions container - side by side layout */
.game-actions #biddingActions {
    display: flex !important;
    gap: 20px !important; /* Space between buttons */
    align-items: center !important;
    justify-content: center !important;
}

/* Double size of pick/pass buttons */
.game-actions #pickBtn,
.game-actions #passBtn {
    font-size: 2rem !important; /* Doubled text size */
    padding: 16px 32px !important; /* Doubled padding */
    min-width: 120px !important; /* Ensure adequate width */
    height: 60px !important; /* Doubled height */
    display: flex !important; /* Use flexbox for centering */
    align-items: center !important; /* Center vertically */
    justify-content: center !important; /* Center horizontally */
    text-align: center !important; /* Center text */
}

/* Card dealing animations */
@keyframes dealCard {
    0% {
        transform: translate(-50vw, -50vh) rotate(-180deg) scale(0.3);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
}

@keyframes cardFlip {
    0% {
        transform: rotateY(180deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

@keyframes cardGlow {
    0% {
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.6), 0 0 30px rgba(0, 123, 255, 0.4);
    }
    100% {
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
    }
}

.card-dealing {
    animation: dealCard 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.card-flipping {
    animation: cardFlip 0.6s ease-in-out forwards;
}

.card-glowing {
    animation: cardGlow 1.5s ease-in-out;
}

/* Deck position for dealing animation */
.dealing-deck {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    pointer-events: none;
}

.dealing-deck .card {
    position: absolute;
    background: linear-gradient(145deg, #1a4d3a, #2d5a47);
    border: 2px solid #4a7c59;
    border-radius: 8px;
    width: 120px;  /* Match card-game dimensions */
    height: 168px; /* Match card-game dimensions */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px; /* Increased font size for larger card */
    font-weight: bold;
    color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Stacked deck effect - larger offsets for bigger cards */
.dealing-deck .card:nth-child(1) { transform: translate(-4px, -4px); }
.dealing-deck .card:nth-child(2) { transform: translate(-2px, -2px); }
.dealing-deck .card:nth-child(3) { transform: translate(0px, 0px); }
.dealing-deck .card:nth-child(4) { transform: translate(2px, 2px); }
.dealing-deck .card:nth-child(5) { transform: translate(4px, 4px); }

/* Smooth transition for dealing deck fade out */
.dealing-deck {
    transition: opacity 0.3s ease-out;
}

/* Visual enhancements for dealing animation */
.card-dealing {
    transform-origin: center center;
}

.card-flipping {
    transform-origin: center center;
}

/* Special styling for trump cards during dealing */
.trump-pending {
    border-color: #ffd700;
}

.new-card-pending {
    border-color: #ffa500;
}



.trick-area {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

/* Trick Card Positioning */
.trick-card-position {
    position: absolute;
    transition: all 0.3s ease;
}

.trick-top-left { top: 0; left: 0; }
.trick-top-center { top: 0; left: 50%; transform: translateX(-50%); }
.trick-top-right { top: 0; right: 0; }
.trick-left { top: 50%; left: 0; transform: translateY(-50%); }
.trick-right { top: 50%; right: 0; transform: translateY(-50%); }
.trick-bottom { 
    position: fixed;
    bottom: calc(50vh + 96px + 72px); /* 1 inch above nameplate */
    left: 50%;
    transform: translateX(calc(-50% + 6px - 108px - 36px));
    transition: all 0.3s ease;
}

/* Player Hand Area */
.player-hand-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    padding: 20px;
    padding-top: 20px;
    z-index: 100;
}

.hand-cards {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    max-width: 100%;
    overflow-x: auto;
    padding: 10px 0;
    z-index: 110;
    position: relative;
}

/* Card Animation */
.card-animating {
    transition: all 0.5s ease-out !important;
    z-index: 200 !important;
}

.card-playing {
    opacity: 0.3 !important;
    pointer-events: none;
}

.played-card-final {
    position: fixed !important;
    z-index: 150 !important;
    pointer-events: none;
    opacity: 1 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-table {
        height: 70vh;
    }
    
    .player-position {
        min-width: 140px;
    }
    
    /* Human player nameplate removed */
    
    .trick-bottom {
        transform: translateX(calc(-50% + 6px - 54px - 36px)); /* Adjust for smaller screens */
    }
    
    .player-hand-area {
        padding: 15px;
    }
    
    .hand-cards {
        gap: 8px;
    }
}

@media (max-width: 480px) {
    /* Human player nameplate removed */
    
    .trick-bottom {
        transform: translateX(calc(-50% - 18px - 36px)); /* Further adjust for very small screens */
        bottom: calc(50vh + 78px + 72px); /* Adjust accordingly */
    }
    
    .player-hand-area {
        padding: 10px;
    }
    
    .hand-cards {
        gap: 6px;
        flex-wrap: wrap;
        max-height: 200px;
        overflow-y: auto;
    }
}
    
    .player-nameplate {
        padding: 6px 12px;
        font-size: 0.9rem;
        min-width: 100px;
    }
    
    .top-players-full {
        flex-wrap: wrap;
        padding: 10px 20px;
        gap: 10px;
    }
    
    .top-bot-1, .top-bot-2, .top-bot-3, .top-bot-4 {
        max-width: 150px;
        margin: 0 5px;
    }
}

/* Force hide ace calling buttons during picking phase */
body.picking-phase #callingActions {
    display: none !important;
    visibility: hidden !important;
}

body.picking-phase .btn-ace-call {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
