/* Reset et variables */
:root {
    --primary-color: #5865F2;
    --dark-color: #2C2F33;
    --light-color: #f4f4f4;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: var(--light-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--dark-color);
    color: white;
    padding: 1rem 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.logo-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    margin-right: 1rem;
}

.header .user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.header .default-avatar.small {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
}

.username {
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
}

.nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.discord-btn {
    background-color: var(--primary-color);
}

.discord-btn:hover {
    background-color: #4752C4;
}

/* Main content */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 140px);
}

.hero {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.hero h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

/* Recipes grid */
.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.recipe-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
    cursor: pointer;
}

.recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.recipe-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.item-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.default-icon {
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
}

.default-icon.small {
    width: 16px;
    height: 16px;
    font-size: 0.6rem;
}

.recipe-name {
    font-weight: bold;
    color: var(--dark-color);
    font-size: 0.9rem;
}

/* Grille de craft miniature avec images */
.mini-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;
    background: #f0f0f0;
    padding: 3px;
    border-radius: 4px;
    border: 1px solid #ddd;
    width: 100px;
    height: 100px;
    margin: 0 auto;
}

.grid-slot {
    background: white;
    border: 1px solid #ccc;
    border-radius: 2px;
    min-height: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1px;
}

.grid-slot img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.grid-slot.filled {
    background: #e8f5e8;
    border-color: #57F287;
}

/* Page détail recette - Grille avec images */
.craft-grid-large {
    background: #f0f0f0;
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid #ddd;
    margin: 2rem auto;
    max-width: 300px;
}

.craft-row {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
}

.craft-row:last-child {
    margin-bottom: 0;
}

.craft-slot {
    flex: 1;
    aspect-ratio: 1;
    background: white;
    border: 2px solid #ccc;
    border-radius: 4px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.craft-slot.filled {
    background: #e8f5e8;
    border-color: #57F287;
}

.slot-item-icon {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Badge panoplie */
.set-badge {
    background: #FFD700;
    color: #333;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-top: 0.5rem;
}

.mini-slot {
    background: white;
    border: 1px solid #ccc;
    border-radius: 2px;
    min-height: 0;
    position: relative;
}

.mini-slot.filled {
    background: #e8f5e8;
    border-color: #57F287;
}

.mini-slot[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
}

/* Page détail recette */
.recipe-detail {
    max-width: 600px;
    margin: 0 auto;
}

.back-link {
    color: var(--primary-color);
    text-decoration: none;
    margin-bottom: 1rem;
    display: inline-block;
}

.recipe-detail-header {
    text-align: center;
    margin-bottom: 2rem;
}

.recipe-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.recipe-title-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.recipe-title .default-icon {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
}

.recipe-detail-header h1 {
    color: var(--dark-color);
    margin: 0;
}

.recipe-meta-info {
    color: #666;
}

.craft-slot[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 1000;
}

.recipe-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding-top: 2rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
}

.btn-primary:hover {
    background: #4752C4;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* États */
.no-recipes, .error {
    text-align: center;
    padding: 3rem;
    color: #666;
    grid-column: 1 / -1;
}

.error {
    color: #ED4245;
}

/* Barre de recherche */
.search-bar {
    margin: 1rem 0;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}

/* Footer */
.footer {
    background: var(--dark-color);
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

.loading {
    text-align: center;
    padding: 2rem;
    font-style: italic;
    color: #666;
}

/* Login page */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 2rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    text-align: center;
}

.discord-login-btn {
    display: inline-block;
    background: #5865F2;
    color: white;
    padding: 15px 30px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    margin: 20px 0;
}

.discord-login-btn:hover {
    background: #4752C4;
}

.small-text {
    font-size: 0.9rem;
    color: #666;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.dashboard-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.dashboard-card h3 {
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.btn {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .user-badge {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .recipes-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    .search-bar {
        flex-direction: column;
    }
    
    .recipe-title {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .recipe-actions {
        flex-direction: column;
    }
}

/* Styles pour la page "Mes recettes" */
.my-recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.my-recipe-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.recipe-status {
    margin: 0.5rem 0;
    text-align: center;
}

.recipe-actions {
    margin-top: auto;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    padding-top: 1rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    display: inline-block;
    text-align: center;
}

/* Styles des badges de statut */
.status-badge {
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    display: inline-block;
}

.status-pending {
    background: #FFF3CD;
    color: #856404;
    border: 1px solid #FFEAA7;
}

.status-approved {
    background: #D1ECF1;
    color: #0C5460;
    border: 1px solid #B8DADF;
}

.status-rejected {
    background: #F8D7DA;
    color: #721C24;
    border: 1px solid #F1B0B7;
}

/* Styles pour les messages */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
    margin-bottom: 1rem;
    font-weight: 500;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    margin-bottom: 1rem;
    font-weight: 500;
}

/* Alertes */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-weight: 500;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #b8dadf;
}

/* Styles pour les catégories pliables de l'accueil */
.category-section {
    margin-bottom: 2rem;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    position: relative;
}

.category-header:hover {
    opacity: 0.8;
    transform: translateX(4px);
}

.toggle-icon {
    transition: transform 0.2s ease;
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

.category-recipes-grid {
    transition: all 0.3s ease;
}

/* Animation fluide pour l'ouverture/fermeture */
.category-recipes-grid.collapsing {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}

/* Flèche pour le tooltip */
.category-header::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -10px;
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
    pointer-events: none;
}

/* Ajouter un indicateur visuel au survol */
.category-header::after {
    content: 'Cliquer pour développer/réduire';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -25px;
    font-size: 0.7rem;
    color: #666;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

.category-header:hover::after,
.category-header:hover::before {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .my-recipes-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }
    
    .recipe-actions {
        flex-direction: column;
    }
    
    .btn-sm {
        width: 100%;
    }
}