/* ========================================
   CARDS CSS - Stili carte dinamiche
   ======================================== */

/* CARTA DINAMICA BASE */
.card-dynamic {
    width: var(--card-width);
    height: var(--card-height);
    perspective: 1000px;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
}

.card-border {
    width: 100%;
    height: 100%;
    border-radius: var(--card-border-radius);
    padding: 5px;
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
    border: 3px solid #888;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: visible !important;  /* ⭐ CAMBIATO */
    transition: all 0.3s ease;
}

/* Colori bordo per classe */
.card-naturalistiche { border-color: var(--color-naturalistiche); }
.card-mediche { border-color: var(--color-mediche); }
.card-digitali { border-color: var(--color-digitali); }
.card-umanistiche { border-color: var(--color-umanistiche); }
.card-cognitive { border-color: var(--color-cognitive); }

/* HEADER CARTA */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 5px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 6px;
    margin-bottom: 3px;
}

.card-name {
    font-size: 10px;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.card-type, .card-year {
    font-size: 8px;
    color: #aaa;
    text-transform: uppercase;
}

.card-rarity {
    font-size: 8px;
}

/* ARTWORK */
.card-artwork {
    flex: 1;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    margin: 3px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.artwork-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* STATS */
.card-stats {
    display: flex;
    justify-content: space-around;
    padding: 3px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 6px;
    font-size: 9px;
    font-weight: bold;
    margin-bottom: 3px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-label {
    font-size: 7px;
    color: #888;
    text-transform: uppercase;
}

.stat-value {
    font-size: 12px;
}

.card-cfu { color: var(--color-primary); }
.card-mh { color: var(--color-mediche); }
.card-tp { color: var(--color-umanistiche); }

/* INFO */
.card-info {
    display: flex;
    justify-content: space-between;
    padding: 2px 4px;
    font-size: 7px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    margin-bottom: 3px;
}

.card-classe {
    font-weight: bold;
    color: #fff;
}

.card-dimensione {
    color: #aaa;
}

/* EFFETTO */
.card-effect {
    background: rgba(0, 0, 0, 0.9);
    padding: 4px;
    border-radius: 6px;
    margin-bottom: 3px;
    flex: 1;
    overflow: hidden;
}

.effect-title {
    font-size: 7px;
    font-weight: bold;
    color: var(--color-secondary);
    margin-bottom: 2px;
}

.effect-text {
    font-size: 6px;
    line-height: 1.2;
    color: #fff;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* MOOD REQUISITI */
.card-mood {
    padding: 2px 4px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    font-size: 7px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.mood-label {
    color: #888;
}

.mood-value {
    font-weight: bold;
}

/* CONDIZIONI (Test/Union) */
.card-conditions {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 3px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    margin-bottom: 3px;
}

.condition-item {
    font-size: 7px;
    color: #aaa;
}

/* FOOTER */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 4px;
    font-size: 7px;
    color: #666;
}

.card-number {
    font-style: italic;
}

/* MANO GIOCATORE */
#hand-area {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: var(--gap-medium);
    padding: 10px;
    padding-top: 40px;
    position: relative;
    background: transparent;
    min-height: 190px;
    overflow: visible;
    z-index: var(--z-hand);
}

.hand-card {
    transition: all 0.3s ease;
    cursor: grab;
}

.hand-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

/* ZOOM DESKTOP HOVER - Rimosso, usa Card Preview Area */
.hand-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.5);
    border: 2px solid var(--color-primary);
}

/* CARTA IN CAMPO */
.field-card {
    width: 100%;
    height: 100%;
    cursor: default;
}

/* CARTA RETRO */
.card-back {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2a2a2a, #1a1a1a);
    border: 3px solid #00d4ff;
    border-radius: var(--card-border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-back-design {
    text-align: center;
}

.back-logo {
    font-size: 40px;
    margin-bottom: 10px;
}

.back-text {
    font-size: 12px;
    font-weight: bold;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* CARD PREVIEW STYLES */
.preview-card-webp {
    width: 220px;
    height: 308px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    cursor: default;
    border: 4px solid #888;
}

/* Bordi colorati per classe */
.preview-card-webp.card-naturalistiche {
    border-color: #44ff44;
}

.preview-card-webp.card-mediche {
    border-color: #4444ff;
}

.preview-card-webp.card-digitali {
    border-color: #ff4444;
}

.preview-card-webp.card-umanistiche {
    border-color: #ffcc00;
}

.preview-card-webp.card-cognitive {
    border-color: #ff00ff;
}

.preview-card-webp.pinned {
    box-shadow: 0 10px 40px rgba(255, 204, 0, 0.8), 0 0 20px currentColor;
    filter: brightness(1.1);
}

.preview-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    background: rgba(255, 0, 0, 0.8);
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.preview-close-btn:hover {
    background: rgba(255, 50, 50, 1);
    transform: scale(1.1);
}

/* ========================================
   MINI CARDS - WebP Background
   ======================================== */

.card-mini {
    position: relative;
    overflow: visible !important;  /* ⭐ CAMBIATO DA hidden A visible */
    border-width: 4px !important;
    border-style: solid !important;
}

/* Overlay scuro per leggibilità testo */
.mini-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.5) 0%,
        rgba(0, 0, 0, 0.2) 50%,
        rgba(0, 0, 0, 0.6) 100%
    );
    z-index: 1;
}

/* Header mini card (Nome) */
.mini-card-header {
    position: absolute;
    top: 5px;
    left: 0;
    right: 0;
    padding: 5px;
    z-index: 2;
    text-align: center;
}

.mini-card-name {
    font-size: 11px;
    font-weight: bold;
    color: #fff;
    text-shadow: 
        -1px -1px 0 #000,  
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000,
        0 0 5px rgba(0, 0, 0, 0.8);
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mini-card-type {
    font-size: 8px;
    color: #ffcc00;
    margin-top: 2px;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}

/* Footer mini card (MH / Anno) */
.mini-card-footer {
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    padding: 5px;
    z-index: 2;
    text-align: center;
}

.mini-stat-mh,
.mini-stat-anno {
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    padding: 3px 8px;
    border-radius: 5px;
    display: inline-block;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
}

.mini-stat-mh {
    color: #ff4444;
}

.mini-stat-anno {
    color: #44d4ff;
}

/* ========================================
   MINI CARDS - WebP Background
   ======================================== */

.card-mini {
    position: relative;
    overflow: hidden;
    border-width: 4px !important;
    border-style: solid !important;
}

/* Overlay scuro per leggibilità testo */
.mini-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.5) 0%,
        rgba(0, 0, 0, 0.2) 50%,
        rgba(0, 0, 0, 0.6) 100%
    );
    z-index: 1;
}

/* Header mini card (Nome) */
.mini-card-header {
    position: absolute;
    top: 5px;
    left: 0;
    right: 0;
    padding: 5px;
    z-index: 2;
    text-align: center;
}

.mini-card-name {
    font-size: 11px;
    font-weight: bold;
    color: #fff;
    text-shadow: 
        -1px -1px 0 #000,  
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000,
        0 0 5px rgba(0, 0, 0, 0.8);
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mini-card-type {
    font-size: 8px;
    color: #ffcc00;
    margin-top: 2px;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}

/* Footer mini card (MH / Anno) */
.mini-card-footer {
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    padding: 5px;
    z-index: 2;
    text-align: center;
}

.mini-stat-mh,
.mini-stat-anno {
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    padding: 3px 8px;
    border-radius: 5px;
    display: inline-block;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
}

.mini-stat-mh {
    color: #ff4444;
}

.mini-stat-anno {
    color: #44d4ff;
}

/* ========================================
   CLICK-TO-PLAY - Feedback Visivi
   ======================================== */

/* Carta selezionata */
.hand-card.selected {
    border: 4px solid #ffcc00 !important;
    box-shadow: 0 0 25px rgba(255, 204, 0, 0.9) !important;
    transform: translateY(-15px) scale(1.05);
    cursor: pointer;
    z-index: 100;
}

/* Slot validi (desktop e mobile) */
.card-slot.valid-target {
    border: 3px dashed #44ff44 !important;
    background: rgba(68, 255, 68, 0.15) !important;
    box-shadow: 0 0 15px rgba(68, 255, 68, 0.5) !important;
    animation: pulse-slot 1.2s infinite;
    cursor: pointer;
}

@keyframes pulse-slot {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.7;
        transform: scale(1.02);
    }
}

/* Slot invalidi */
.card-slot.invalid-target {
    border: 2px solid rgba(255, 68, 68, 0.3) !important;
    background: rgba(255, 68, 68, 0.05) !important;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Animazione shake per slot invalido cliccato */
.card-slot.shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}
/* ========================================
   TEXTBOX EFFETTO CARTA IN PREVIEW
   ======================================== */

#card-preview-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Container per immagine + textbox */
.preview-card-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Textbox effetto carta */
.preview-effect-text {
    width: 100%;
    max-width: 220px;
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid rgba(0, 212, 255, 0.5);
    border-radius: 10px;
    padding: 12px;
    
    /* Text styling */
    color: #fff;
    font-size: 11px;
    line-height: 1.4;
    text-align: left;
    
    /* Scrollable se troppo lungo */
    max-height: 150px;
    overflow-y: auto;
}

/* Titolo effetto */
.preview-effect-title {
    font-size: 10px;
    font-weight: bold;
    color: #ffcc00;
    text-transform: uppercase;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

/* Descrizione */
.preview-effect-description {
    font-size: 10px;
    color: #ddd;
}

/* Scrollbar custom per textbox */
.preview-effect-text::-webkit-scrollbar {
    width: 4px;
}

.preview-effect-text::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.preview-effect-text::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.6);
    border-radius: 2px;
}

.preview-effect-text::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.9);
}
