/**
 * ═══════════════════════════════════════════════════════════
 *  CROPSIDE V2 - DESIGN MINIMALISTE + LOADING SCREEN
 *  Background transparent, UI discrète, champ visible
 * ═══════════════════════════════════════════════════════════
 */

/* ═══ IMPORTS FONTS ═══ */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&family=Fredoka:wght@500;600;700&display=swap');

/* ═══ VARIABLES ═══ */
:root {
    /* Couleurs UI discrètes */
    --ui-dark: rgba(0, 0, 0, 0.7);
    --ui-darker: rgba(0, 0, 0, 0.85);
    --ui-light: rgba(255, 255, 255, 0.1);
    
    /* Couleurs gameplay */
    --orange-action: #ff6f00;
    --orange-hover: #f57c00;
    --green-primary: #4caf50;
    --blue-water: #42a5f5;
    --gold: #ffc107;
    
    /* Bois pour boutons */
    --wood-panel: #8d6e63;
    --wood-dark: #6d4c41;
    --wood-darker: #4e342e;
    
    /* Texte */
    --text-light: #ffffff;
    --text-dark: #1a1a1a;
    
    /* Ombres */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    
    /* Transitions */
    --transition: 200ms ease;
}

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

body {
    font-family: 'Poppins', -apple-system, sans-serif;
    background: transparent; /* TRANSPARENT POUR VOIR LE CHAMP ! */
    color: var(--text-light);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

/* ═══ LOADING SCREEN STYLÉ ═══ */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a3a1a 0%, #2d1a0f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-content {
    text-align: center;
    max-width: 400px;
    padding: 32px;
}

.loading-logo {
    margin-bottom: 32px;
    animation: fadeInDown 0.6s ease;
}

.loading-plant {
    width: 120px;
    height: 120px;
    object-fit: contain;
    animation: bounce 2s infinite ease-in-out;
    filter: drop-shadow(0 4px 12px rgba(76, 175, 80, 0.3));
}

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loading-logo h1 {
    font-size: 48px;
    font-weight: 800;
    margin-top: 16px;
    background: linear-gradient(135deg, var(--green-primary) 0%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-text {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 24px;
    animation: fadeIn 0.8s ease 0.3s backwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.loading-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
    animation: fadeIn 0.8s ease 0.4s backwards;
}

.loading-progress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--green-primary) 0%, var(--gold) 100%);
    border-radius: 10px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--green-primary);
}

.loading-tip {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    animation: fadeIn 0.8s ease 0.5s backwards;
}

/* ═══ GAME CONTAINER ═══ */
#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#game-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ═══ UI OVERLAY ═══ */
#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.5s ease;
}

#ui-overlay > * {
    pointer-events: auto;
}

/* ═══ TOP BAR MINIMALISTE ═══ */
#top-bar {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    height: 60px;
    background: var(--ui-dark);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 20px;
    box-shadow: var(--shadow-md);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green-primary) 0%, #2e7d32 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-sm);
}

.player-name {
    font-size: 15px;
    font-weight: 600;
}

.stats-container {
    display: flex;
    gap: 16px;
    margin-left: auto;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.stat-icon {
    font-size: 20px;
}

.stat-value {
    font-size: 16px;
    font-weight: 700;
}

.menu-button {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}

.menu-button:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

/* ═══ INVENTAIRE COMPACT - COIN HAUT GAUCHE ═══ */
.inventory-panel {
    position: absolute;
    left: 16px;
    top: 92px;
    width: 280px;
    background: var(--ui-dark);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow-lg);
}

.inventory-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.tab-button {
    flex: 1;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 8px;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 600;
    font-family: 'Fredoka', sans-serif;
    cursor: pointer;
    transition: all var(--transition);
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tab-button.active {
    background: var(--green-primary);
    transform: scale(1.02);
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.inventory-slot {
    width: 56px;
    height: 56px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.inventory-slot:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--green-primary);
    transform: translateY(-2px);
}

.inventory-slot.selected {
    background: rgba(76, 175, 80, 0.2);
    border-color: var(--green-primary);
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.4);
}

.inventory-slot img {
    width: 70%;
    height: 70%;
    object-fit: contain;
}

.inventory-slot .quantity {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

/* ═══ TOOLBAR BAS - 4 BOUTONS RONDS ═══ */
#toolbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    background: var(--ui-dark);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}

.tool-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--wood-panel) 0%, var(--wood-dark) 100%);
    border: 3px solid var(--wood-darker);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}

.tool-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: var(--shadow-lg);
}

.tool-btn.active {
    background: linear-gradient(135deg, var(--orange-action) 0%, #e65100 100%);
    border-color: var(--gold);
    box-shadow: 0 0 16px rgba(255, 111, 0, 0.5);
}

.tool-icon {
    font-size: 32px;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

/* ═══ MODAL ═══ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--ui-dark);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 32px;
    max-width: 450px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal h3 {
    font-size: 24px;
    margin-bottom: 16px;
    font-weight: 700;
}

.modal p {
    font-size: 15px;
    margin-bottom: 24px;
    color: rgba(255, 255, 255, 0.8);
}

.modal-buttons {
    display: flex;
    gap: 12px;
}

.modal-btn {
    flex: 1;
    height: 44px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.modal-btn.cancel {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

.modal-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.15);
}

.modal-btn.confirm {
    background: var(--green-primary);
    color: white;
}

.modal-btn.confirm:hover {
    background: #45a049;
    transform: translateY(-2px);
}

/* ═══ AUTH PAGES - ANIMÉES AVEC VRAIES IMAGES ═══ */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: linear-gradient(135deg, #1a3a1a 0%, #2d1a0f 100%);
    position: relative;
    overflow: hidden;
}

/* Effet particules animées */
.auth-container::before,
.auth-container::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
    animation: float 20s infinite ease-in-out;
}

.auth-container::before {
    width: 400px;
    height: 400px;
    background: var(--green-primary);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.auth-container::after {
    width: 300px;
    height: 300px;
    background: var(--gold);
    bottom: -80px;
    right: -80px;
    animation-delay: 5s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, 50px) scale(1.1); }
}

/* Décorations avec VRAIES IMAGES de plantes */
.auth-decorations {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.deco-plant {
    position: absolute;
    opacity: 0.15;
    animation: floatPlant 8s infinite ease-in-out;
}

.deco-plant img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.deco-plant:nth-child(1) { animation-delay: 0s; }
.deco-plant:nth-child(2) { animation-delay: 2s; }
.deco-plant:nth-child(3) { animation-delay: 4s; }
.deco-plant:nth-child(4) { animation-delay: 6s; }

@keyframes floatPlant {
    0%, 100% {
        opacity: 0.1;
        transform: translateY(0) rotate(0deg);
    }
    50% {
        opacity: 0.2;
        transform: translateY(-20px) rotate(5deg);
    }
}

.auth-card {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 12px;
    font-size: 42px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--green-primary) 0%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeIn 0.8s ease 0.2s backwards;
}

.auth-card .subtitle {
    text-align: center;
    margin-bottom: 36px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 15px;
    animation: fadeIn 0.8s ease 0.3s backwards;
}

.form-group {
    margin-bottom: 20px;
    animation: slideInLeft 0.5s ease backwards;
}

.form-group:nth-child(1) { animation-delay: 0.4s; }
.form-group:nth-child(2) { animation-delay: 0.5s; }
.form-group:nth-child(3) { animation-delay: 0.6s; }

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-light);
    font-size: 15px;
    transition: all var(--transition);
}

.form-group input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--green-primary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.error, .success {
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    animation: slideUp 0.3s ease;
}

.error {
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: #ff6b6b;
}

.success {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #66bb6a;
}

button[type="submit"], .btn {
    width: 100%;
    height: 52px;
    background: linear-gradient(135deg, var(--green-primary) 0%, #2e7d32 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.8s ease 0.7s backwards;
}

button[type="submit"]:hover, .btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.links {
    text-align: center;
    margin-top: 24px;
    animation: fadeIn 0.8s ease 0.8s backwards;
}

.links a {
    color: var(--gold);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}

.links a:hover {
    color: var(--green-primary);
}

.footer {
    text-align: center;
    margin-top: 28px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    animation: fadeIn 0.8s ease 0.9s backwards;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    #top-bar {
        height: 52px;
        padding: 0 12px;
    }
    
    .inventory-panel {
        width: 240px;
        padding: 12px;
    }
    
    .inventory-slot {
        width: 48px;
        height: 48px;
    }
    
    .tool-btn {
        width: 56px;
        height: 56px;
    }
    
    #toolbar {
        gap: 12px;
        padding: 10px;
    }
    
    .loading-plant {
        width: 80px;
        height: 80px;
    }
    
    .deco-plant img {
        width: 80px;
        height: 80px;
    }
}
