/* ========================================================================= 
   STYLE MODERN - AGRIVIRTUEL (Basé sur fs-auctions et loto)
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg-primary: #0a0e17;
    --text-primary: #ffffff;
    --text-secondary: #8b9bb4;

    /* Couleurs de la DA AgriVirtuel */
    --accent-blue: #5865F2;
    --accent-blue-hover: #4752C4;
    --accent-green: #3ba55d;
    --accent-red: #ed4245;

    --card-bg: rgba(23, 27, 35, 0.7);
    --card-border: rgba(255, 255, 255, 0.05);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ==================== BACKGROUND ANIMÉ ==================== */
.bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: radial-gradient(circle at 15% 50%, rgba(30, 215, 96, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(88, 101, 242, 0.08), transparent 25%);
    animation: bgPulse 15s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.1);
    }
}

/* ==================== LAYOUT ==================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
    width: 100%;
}

/* ==================== HEADER ==================== */
.header {
    background: rgba(23, 27, 35, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px 30px;
    margin-bottom: 40px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.title {
    font-size: 24px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
}

.title .icon {
    font-size: 28px;
}

/* ==================== PROFIL UTILISATEUR ==================== */
.user-profile {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    margin-right: 12px;
}

.user-info {
    margin-right: 20px;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-farm {
    font-size: 12px;
    color: var(--accent-green);
    font-weight: 500;
}

.btn-logout {
    background: rgba(237, 66, 69, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(237, 66, 69, 0.3);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(237, 66, 69, 0.2);
    border-color: var(--accent-red);
}

/* ==================== PAGE DE CONNEXION ==================== */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 48px;
    text-align: center;
    max-width: 450px;
    width: 100%;
    box-shadow: var(--glass-shadow);
}

.login-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.login-subtitle {
    color: var(--text-secondary);
    margin: 10px 0 30px;
}

.btn-login {
    background: linear-gradient(135deg, rgba(88, 101, 242, 0.9), rgba(71, 82, 196, 0.9));
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(88, 101, 242, 0.3);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(88, 101, 242, 0.4);
}

.btn-login .login-icon {
    font-size: 20px;
    margin: 0;
}

/* ==================== CATALOGUE ET BOUTONS ==================== */
.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.catalogue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* ==================== CARTES DE JEUX (Basées sur auction-card) ==================== */
.auction-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.auction-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: var(--glass-shadow);
}

.auction-content {
    padding: 24px;
}

.auction-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.auction-seller {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.btn-bid {
    background: linear-gradient(135deg, rgba(30, 215, 96, 0.9), rgba(25, 180, 80, 0.9));
    color: white;
    border: none;
    padding: 12px;
    border-radius: 10px;
    width: 100%;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-bid:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30, 215, 96, 0.3);
}

/* ==================== MODAL OVERLAY ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* ==================== ALERTE GLOBALE ==================== */
.alert-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert {
    padding: 15px 20px;
    border-radius: 10px;
    color: white;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert.success {
    background: var(--accent-green);
}

.alert.error {
    background: var(--accent-red);
}

/* ==================== FOOTER ==================== */
footer {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: auto;
}

/* ==================== V4 PREMIUM DASHBOARD JEU ==================== */
.game-dashboard {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    justify-content: center;
    margin-top: 20px;
    perspective: 1000px;
}

.game-panel {
    flex: 1;
    max-width: 320px;
    background: rgba(15, 20, 25, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.game-panel:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.game-panel-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.game-panel-title.instructions {
    color: #4ade80;
    /* Vert fluo premium */
}

.game-panel-title.tips {
    color: #fbbf24;
    /* Ambre doré premium */
}

.game-panel-content {
    color: #cbd5e1;
    font-size: 15px;
    line-height: 1.6;
    font-weight: 400;
}

.game-center-container {
    flex: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1000px;
}

.game-center-header {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
}

.game-title-glowing {
    font-size: 36px;
    font-weight: 800;
    color: white;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3), 0 0 40px rgba(30, 215, 96, 0.2);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

/* Base Wrapper pour tous les jeux V4 */
.v4-game-wrapper {
    background: rgba(10, 14, 23, 0.8);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 30px 60px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(30, 215, 96, 0.1) inset;
    padding: 10px;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
}

/* Décorations d'angle Premium Neon */
.v4-game-wrapper::before,
.v4-game-wrapper::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border: 2px solid transparent;
    pointer-events: none;
    z-index: 5;
}

.v4-game-wrapper::before {
    top: 10px;
    left: 10px;
    border-top-color: var(--accent-green);
    border-left-color: var(--accent-green);
    border-radius: 8px 0 0 0;
}

.v4-game-wrapper::after {
    bottom: 10px;
    right: 10px;
    border-bottom-color: var(--accent-green);
    border-right-color: var(--accent-green);
    border-radius: 0 0 8px 0;
}

/* Boutons premium animés (overlay de fin de jeu) */
.btn-premium {
    background: linear-gradient(135deg, rgba(30, 215, 96, 0.9), rgba(20, 160, 60, 0.9));
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 14px 32px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(30, 215, 96, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-premium:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 35px rgba(30, 215, 96, 0.5);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-premium:active {
    transform: translateY(1px);
}

/* Modales d'overlay en jeu pur Glassmorphism */
.v4-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 23, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 12px;
    /* Inner radius du wrapper */
    opacity: 0;
    animation: fadeInOverlay 0.4s forwards ease-out;
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.v4-overlay-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    max-width: 85%;
    transform: translateY(20px);
    animation: slideUpCard 0.5s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUpCard {
    to {
        transform: translateY(0);
    }
}

.v4-overlay-title {
    font-size: 28px;
    font-weight: 800;
    color: white;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #a0a0a0 100%);
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ==================== RESPONSIVE MOBILE ==================== */
@media (max-width: 900px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .user-profile {
        flex-wrap: wrap;
        justify-content: center;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .catalogue-grid {
        grid-template-columns: 1fr;
    }

    .game-dashboard {
        flex-direction: column;
        align-items: stretch;
    }
    
    .game-panel {
        max-width: 100%;
        order: 2; /* Les panneaux passent sous le jeu */
    }
    
    .game-center-container {
        order: 1; /* Le jeu reste en haut */
    }
    
    .v4-game-wrapper {
        padding: 0px;
    }
}