/* Spanish Solitaire Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    padding: 20px;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.game-header {
    text-align: center;
    margin-bottom: 30px;
}

.game-title {
    color: white;
    font-size: 2.5em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
}

.game-info {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1em;
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: nowrap;
}

.info-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

.game-board {
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 20px;
    min-height: 600px;
}

.top-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.stock-waste {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.foundations {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.tableau {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 15px;
}

.card-slot {
    width: 100px;
    height: 140px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.card-slot:hover {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.card-slot.valid-drop {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.2);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.4);
}

.card {
    width: 100px;
    height: 140px;
    border-radius: 12px;
    border: 2px solid #333;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    position: absolute;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    user-select: none;
    overflow: hidden;
    position: relative;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.card.dragging {
    opacity: 0.8;
    transform: rotate(3deg) scale(1.05);
    z-index: 1000;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

.card.selected {
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 8px 20px rgba(0, 0, 0, 0.25);
    transform: translateY(-3px);
}

.card.face-down {
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 50%, #8B4513 100%);
    color: #D2691E;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
}

.card.face-down::before {
    content: "🃏";
}

/* Card corners with values */
.card-corner {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.card-corner.top-right {
    top: 4px;
    right: 4px;
}

.card-corner.bottom-left {
    bottom: 4px;
    left: 4px;
    transform: rotate(180deg);
}

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

.corner-value {
    font-size: 2.2em; /* Double the original 1.1em */
    font-weight: 900;
    color: #000;
    line-height: 1;
}

.corner-suit {
    width: 30px; /* Double the original 15px */
    height: 30px;
}

.corner-suit img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Central suit image */
.center-suit {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    opacity: 1;
}

.center-suit img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Suit color styling */
.card.coins .corner-value,
.card.cups .corner-value {
    color: #dc3545; /* Red for coins and cups */
}

.card.clubs .corner-value,
.card.swords .corner-value {
    color: #000; /* Black for clubs and swords */
}

.tableau-column {
    min-height: 200px;
    position: relative;
}

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

/* Card spacing is now handled dynamically by JavaScript */

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: nowrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-icon {
    font-size: 1.2em;
}

.btn-text {
    font-size: 0.9em;
}

.btn-primary {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.win-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1999;
    display: none;
}

/* Mobile touch interaction improvements */
.card {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.card.selected {
    transform: translateY(-10px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border: 3px solid #007bff;
    transition: all 0.2s ease;
}

.card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Visual feedback for touch events */
@media (max-width: 768px) {
    .card:hover {
        transform: none; /* Disable hover on mobile */
    }
    
    .card:active {
        transform: scale(0.95);
        opacity: 0.9;
    }
    
    .card.selected {
        transform: translateY(-5px);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    }
}

/* Prevent text selection on game elements */
.game-container {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Make drop zones more obvious on mobile */
@media (max-width: 768px) {
    .card-slot:empty {
        border: 2px dashed rgba(255, 255, 255, 0.3);
        background: rgba(255, 255, 255, 0.1);
    }
    
    .foundation:empty::after {
        content: '♠';
        color: rgba(255, 255, 255, 0.3);
        font-size: 2em;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    
    .foundation[data-suit="dheb"]:empty::after { content: '♦'; }
    .foundation[data-suit="lekhel"]:empty::after { content: '♥'; }
    .foundation[data-suit="koubbas"]:empty::after { content: '♠'; }
    .foundation[data-suit="chbada"]:empty::after { content: '♣'; }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .game-info {
        gap: 20px;
        font-size: 1em;
    }
    
    .info-item {
        padding: 6px 12px;
        font-size: 0.9em;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        font-size: 14px;
    }
    
    .game-container {
        padding: 15px;
        margin: 0;
        border-radius: 10px;
    }
    
    .game-board {
        min-height: 400px; /* Reduce for mobile */
        gap: 10px; /* Reduce gap */
    }
    
    .game-title {
        font-size: 1.8em;
        margin-bottom: 15px;
    }
    
    .game-info {
        gap: 15px;
        font-size: 0.9em;
    }
    
    .info-item {
        padding: 6px 12px;
        font-size: 0.85em;
    }
    
    /* Reduce tableau column minimum height for mobile */
    .tableau-column {
        min-height: 100px;
    }
    
    /* Keep 7-column layout on mobile */
    .tableau {
        grid-template-columns: repeat(7, 1fr);
        gap: 5px;
    }
    
    /* Smaller cards for mobile to fit 7 columns */
    .card {
        width: 40px;
        height: 56px;
        border-radius: 6px;
    }
    
    .card-slot {
        width: 40px;
        height: 56px;
        border-radius: 6px;
    }
    
    /* Adjust card content for smaller cards */
    .corner-value {
        font-size: 1.1em; /* Double the original 0.55em */
    }
    
    .corner-suit {
        width: 14px; /* Double the original 7px */
        height: 14px;
    }
    
    .center-suit {
        width: 22px;
        height: 22px;
    }
    
    
    /* Adjust card corners for smaller cards */
    .card-corner.top-left {
        top: 2px;
        left: 2px;
    }
    
    .card-corner.top-right {
        top: 2px;
        right: 2px;
    }
    
    .card-corner.bottom-left {
        bottom: 2px;
        left: 2px;
    }

    .card-corner.bottom-right {
        bottom: 2px;
        right: 2px;
    }
    
    /* Adjust game layout for mobile */
    .top-area {
        gap: 5px;
        margin-bottom: 15px;
    }
    
    .stock-waste {
        gap: 5px;
    }
    
    .foundations {
        gap: 5px;
    }
    
    .tableau {
        gap: 5px;
    }
    
    /* Mobile-friendly controls */
    .controls {
        gap: 6px;
        margin-top: 15px;
        flex-wrap: nowrap;
        justify-content: space-between;
    }
    
    .btn {
        flex: 1;
        padding: 8px 6px;
        font-size: 0.75em;
        border-radius: 15px;
        min-width: 0;
        gap: 4px;
    }
    
    .btn-icon {
        font-size: 1em;
        flex-shrink: 0;
    }
    
    .btn-text {
        font-size: 0.7em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Touch-friendly interactions */
    .card:hover {
        transform: none; /* Disable hover effects on mobile */
    }
    
    .card.selected {
        transform: scale(1.05);
        z-index: 100;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .game-container {
        padding: 8px;
    }
    
    .game-board {
        min-height: 300px; /* Even smaller for very small mobile */
        gap: 5px; /* Very tight gap */
    }
    
    .game-title {
        font-size: 1.5em;
    }
    
    .game-info {
        gap: 8px;
        font-size: 0.8em;
        flex-wrap: nowrap;
    }
    
    .info-item {
        padding: 4px 8px;
        font-size: 0.75em;
        white-space: nowrap;
    }
    
    /* Reduce tableau column minimum height for very small mobile */
    .tableau-column {
        min-height: 80px;
    }
    
    /* Ensure 7-column layout on very small mobile */
    .tableau {
        grid-template-columns: repeat(7, 1fr);
        gap: 3px;
    }
    
    /* Even smaller cards for very small screens */
    .card {
        width: 35px;
        height: 49px;
    }
    
    .card-slot {
        width: 35px;
        height: 49px;
    }
    
    /* Adjust card content */
    .corner-value {
        font-size: 1.0em; /* Double the original 0.5em */
    }
    
    .corner-suit {
        width: 12px; /* Double the original 6px */
        height: 12px;
    }
    
    /* Adjust card corners for very small cards */
    .card-corner.top-left {
        top: 1px;
        left: 1px;
    }
    
    .card-corner.top-right {
        top: 1px;
        right: 1px;
    }
    
    .card-corner.bottom-left {
        bottom: 1px;
        left: 1px;
    }
    
    .card-corner.bottom-right {
        bottom: 1px;
        right: 1px;
    }
    
    .center-suit {
        width: 18px;
        height: 18px;
    }
    
    
    .top-area {
        gap: 3px;
    }
    
    .foundations {
        gap: 3px;
    }
    
    .tableau {
        gap: 3px;
    }
    
    .controls {
        gap: 4px;
        flex-wrap: nowrap;
        justify-content: space-between;
        overflow: visible;
    }
    
    .btn {
        flex: 1;
        min-width: 0;
        padding: 8px 4px;
        gap: 4px;
    }
    
    .btn-icon {
        font-size: 0.9em;
        flex-shrink: 0;
    }
    
    .btn-text {
        font-size: 0.7em;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Hint system styles */
.hint-card {
    animation: hint-pulse 1.5s ease-in-out infinite;
    border: 3px solid #FFD700 !important;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.8) !important;
    z-index: 500;
}

.hint-destination {
    animation: hint-glow 1.5s ease-in-out infinite;
    border: 3px solid #4CAF50 !important;
    background: rgba(76, 175, 80, 0.3) !important;
}

.hint-stock {
    animation: hint-bounce 1s ease-in-out infinite;
    border: 3px solid #2196F3 !important;
    box-shadow: 0 0 20px rgba(33, 150, 243, 0.6) !important;
}

@keyframes hint-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes hint-glow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(76, 175, 80, 0.4);
    }
    50% {
        box-shadow: 0 0 25px rgba(76, 175, 80, 0.8);
    }
}

@keyframes hint-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}
