/* Glassmorphism panels */
.glass-panel {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.glass-panel:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* Buttons */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0.9rem 2.8rem;
    border-radius: 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(140deg,
                var(--c1, #482ee6) 0%,
                var(--c2, #0ab0b9) 40%,
                var(--c3, #d8932b) 100%);
    background-size: 400% 400%;
    border: 1px solid rgba(255,255,255,.25);
    backdrop-filter: blur(6px) saturate(120%);
    box-shadow:
        0 2px 8px rgba(0,0,0,.25),
        inset 0 0 4px rgba(255,255,255,.4);
    cursor: pointer;
    text-decoration: none;
    min-width: 150px; /* Adjusted min-width for shorter button texts */
    overflow: hidden;
    transition:
        background-position 4s linear,
        transform .25s ease,
        box-shadow .25s ease;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    background-position: 120% 50%;
    transform: translateY(-2px);
    box-shadow:
        0 4px 14px rgba(0,0,0,.35),
        inset 0 0 4px rgba(255,255,255,.6);
}

/* Extra glowing effect around buttons */
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: inherit;
    filter: blur(8px);
    opacity: .45;
    z-index: -1;
}

/* Button accents - Using the final definition from "Hi-tech neon backdrop" section */
.btn-primary {
    mix-blend-mode: screen;
    background: linear-gradient(140deg,
                var(--c1, #482ee6) 0%,
                var(--c2, #0ab0b9) 60%,
                var(--c3, #d8932b) 100%);
}

.btn-primary:hover {
    background-position: 120% 50%;
}

.btn-secondary {
    background: linear-gradient(140deg,
                rgba(var(--c1, #482ee6), 0.7) 0%,
                rgba(var(--c2, #0ab0b9), 0.7) 40%,
                rgba(var(--c3, #d8932b), 0.7) 100%);
    opacity: 0.85;
}

.btn-secondary:hover {
    opacity: 1;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    background-position: 0% 0% !important;
    box-shadow: none !important;
}

/* Accessibility - keyboard focus styles */
.btn:focus-visible {
    outline: none;
    box-shadow: 
        0 0 0 3px rgba(255,255,255,0.7),
        0 0 0 6px var(--c2, #0ab0b9);
    transform: translateY(-2px);
    transition: box-shadow 0.2s ease;
}

/* In-Game Settings Button */
.in-game-settings-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1500;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.in-game-settings-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.settings-icon {
    font-size: 1.5rem;
}


.btn.active-sort {
    background: linear-gradient(135deg, #4facfe 0%, #2ecc71 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.5);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-small {
    padding: 10px 20px;
    font-size: 0.9rem;
    min-width: auto; 
    margin-top: 10px; 
    width: 100%; 
}

/* Cards */
.card {
    width: 80px;
    height: 120px; /* Increased height for new layout */
    background: white;
    border-radius: 8px;
    border: 2px solid #ddd;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between; /* Rank top, Suit bottom, Icon area middle */
    padding: 5px 4px; /* Adjusted padding */
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    user-select: none;
}

.card:hover {
    transform: translateY(-15px) scale(1.05);
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 2px solid #2196f3;
    box-shadow: 
        0 12px 30px rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px rgba(33, 150, 243, 0.3),
        0 0 20px rgba(33, 150, 243, 0.4);
    animation: cardHoverWobble 0.6s ease-in-out infinite alternate;
    z-index: 10;
}

@keyframes cardHoverWobble {
    0% { 
        transform: translateY(-15px) scale(1.05) rotate(-0.5deg) translateX(-1px);
    }
    100% { 
        transform: translateY(-15px) scale(1.05) rotate(0.5deg) translateX(1px);
    }
}

.card.selected:hover {
    /* Override hover effects for selected cards */
    background: white;
    border: 2px solid #ddd;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    animation: none;
    transform: translateY(-15px) scale(1.05);
}

/* Ensure selected cards maintain their position but lose hover effects */
.card.selected {
    transform: translateY(-10px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    /* The existing transition on .card will make this snappy */
    /* border-color can remain the default or be styled if needed, e.g., border-color: #f1c40f; */
    background: white;
    border: 2px solid #ddd;
    animation: none;
}

.card.selected:hover {
    /* Prevent additional hover effects on selected cards */
    transform: translateY(-15px) scale(1.05);
}

/* Right-click drag selection visual indicator */
.card.drag-hover {
    border: 2px solid #f1c40f;
    box-shadow: 
        0 12px 30px rgba(241, 196, 15, 0.4),
        inset 0 0 0 1px rgba(241, 196, 15, 0.3);
}

/* Right-click drag selection cursor */
.game-container.right-drag-active {
    cursor: crosshair;
}

.game-container.right-drag-active .card:hover {
    border-color: #f1c40f;
}

.card-rank {
    font-size: 1.2rem;
    font-weight: bold;
    line-height: 1;
    /* text-align: left; */ /* Align to top-left if desired, but center is default for flex item */
    /* width: 100%; */
    /* padding-left: 4px; */
}

.card-icon-area {
    display: flex;
    flex-direction: column; /* Stack icons if multiple */
    align-items: center;
    justify-content: center;
    gap: 4px; /* Space between icons if multiple */
    flex-grow: 1; /* Allow this area to take up available space */
    width: 100%;
}

.card-bonus-chips-icon,
.card-bonus-multiplier-icon {
    font-size: 1.8rem; /* Approx double the old icon size */
    line-height: 1;
    font-weight: bold; /* Make icons a bit bolder */
}

.card-bonus-chips-icon {
    color: #34adee; /* Vibrant blue */
    text-shadow: 0 0 4px rgba(52, 173, 238, 0.6), 0 0 6px rgba(52, 173, 238, 0.3);
}

.card-bonus-multiplier-icon {
    color: #e74c3c; /* Vibrant red */
    text-shadow: 0 0 4px rgba(231, 76, 60, 0.6), 0 0 6px rgba(231, 76, 60, 0.3);
}

.card-bonus-money-icon{
    color:#2ecc71;
    text-shadow:0 0 4px rgba(46,204,113,.6),0 0 6px rgba(46,204,113,.3);
}
.card-bonus-random-icon{
    color:#f1c40f;
    text-shadow:0 0 4px rgba(241,196,15,.6),0 0 6px rgba(241,196,15,.3);
}

.card-suit {
    font-size: 1.5rem;
    line-height: 1;
    /* text-align: left; */ /* Align to bottom-left if desired */
    /* width: 100%; */
    /* padding-left: 4px; */
}

/* Suit colors - Using the final definitions from "4-colour deck" section */
.card.hearts .card-rank,
.card.hearts .card-suit {
    color: #e74c3c; 
}
.card.diamonds .card-rank,
.card.diamonds .card-suit {
    color: #3498db; 
}
.card.clubs .card-rank,
.card.clubs .card-suit {
    color: #2ecc71; 
}
.card.spades .card-rank,
.card.spades .card-suit {
    color: #000000; 
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content { /* Base style for modal content area, often a .glass-panel */
    padding: 40px;
    max-width: 400px; /* Default max-width, can be overridden */
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-content h3 {
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Mini card (used in Remaining Deck Modal) */
.mini-card {
    background: #ffffff;
    color: #222222;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 1rem;
    font-weight: 600;
    min-width: 40px;
    min-height: 50px;
    text-align: center;
    border: 1px solid #ccc;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    margin: 3px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mini-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.mini-card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.mini-card-effect {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: white;
}

.mini-card.special {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff !important;
}

/* Tooltip Styles */
.tooltip {
    position: fixed; /* Use fixed to position relative to viewport */
    background-color: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    font-size: 0.9rem;
    line-height: 1.4;
    z-index: 2000; /* Ensure it's above most other elements */
    pointer-events: none; /* Tooltip should not interfere with mouse events */
    display: none; /* Initially hidden */
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    max-width: 250px; /* Prevent tooltip from becoming too wide */
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tooltip strong {
    color: #00e5ff; /* Accent color for the name */
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

/* Boss Alert Styles */
.boss-info {
    margin-top: 15px;
    display: none;
}

.boss-alert {
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid rgba(255, 0, 0, 0.4);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

.boss-alert h3 {
    color: #ff5252;
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.boss-alert p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

.card-bonus-money-icon{
    color:#2ecc71;
    text-shadow:0 0 4px rgba(46,204,113,.6),0 0 6px rgba(46,204,113,.3);
}

/* Turbo connection line animation */
.turbo-connection {
    position: fixed;
    background: linear-gradient(90deg, #f093fb, #f5576c);
    height: 3px;
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(240, 147, 251, 0.8);
    pointer-events: none;
    z-index: 2000;
}

/* Settings Modal Styles */
.settings-section {
    margin: 20px 0;
}

.setting-item {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting-item label {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    min-width: 120px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
}

.slider-container input[type="range"] {
    width: 120px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.slider-container input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-container input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #667eea;
}

.toggle-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    min-width: 60px;
}

/* Card Styles */
.card {
    width: 80px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/*                          DRAG & DROP STYLES                              */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* Card being dragged (original position) */
.card-dragging {
    opacity: 0 !important;
    transform: translateY(-10px) scale(1.05) !important;
    transition: opacity 0.2s ease, transform 0.2s ease !important;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4) !important;
}

/* Drag preview (follows cursor) */
.card-drag-preview {
    opacity: 0.95;
    transform: rotate(0deg) scale(1.15);
    transition: transform 0.1s ease-out, opacity 0.1s ease;
    box-shadow:
        0 15px 40px rgba(0, 0, 0, 0.5),
        0 0 0 3px rgba(102, 126, 234, 0.6),
        inset 0 2px 0 rgba(255, 255, 255, 0.4),
        0 0 30px rgba(102, 126, 234, 0.8) !important;
    filter: brightness(1.2) saturate(1.3);
    cursor: grabbing !important;
    animation: dragPreviewPulse 1.5s ease-in-out infinite;
}

@keyframes dragPreviewPulse {
    0%, 100% {
        box-shadow:
            0 15px 40px rgba(0, 0, 0, 0.5),
            0 0 0 3px rgba(102, 126, 234, 0.6),
            inset 0 2px 0 rgba(255, 255, 255, 0.4),
            0 0 30px rgba(102, 126, 234, 0.8);
    }
    50% {
        box-shadow:
            0 15px 40px rgba(0, 0, 0, 0.5),
            0 0 0 3px rgba(240, 147, 251, 0.8),
            inset 0 2px 0 rgba(255, 255, 255, 0.4),
            0 0 40px rgba(240, 147, 251, 1);
    }
}

/* Body cursor change during drag */
body.card-drag-active {
    cursor: grabbing !important;
}

body.card-drag-active .card {
    cursor: grabbing !important;
}

/* Disable pointer events on cards during drag to prevent hover sounds */
body.card-drag-active .card:not(.card-drag-preview) {
    pointer-events: none !important;
}

/* Prevent card hover effects during drag */
.card-drag-active .card:not(.card-dragging):hover {
    transform: translateY(0) scale(1);
    animation: none;
}

/* Card container during drag */
.card-container {
    position: relative;
}

/* Smooth card transitions when making space */
.card {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Enhanced grab cursor for cards when not dragging */
.card:not(.card-dragging) {
    cursor: grab;
}

.card:not(.card-dragging):active {
    cursor: grabbing;
}
