/* Variables CSS pour les thèmes */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-card: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border: #e0e0e0;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --success: #10b981;
    --error: #ef4444;
    --shadow: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-card: #1f1f1f;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border: #2a2a2a;
    --shadow: rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header/Navbar */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px var(--shadow);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

/* Badge de notification */
.notification-badge {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    transition: all 0.3s;
    text-decoration: none;
}

.notification-badge:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.1);
}

.notification-icon {
    font-size: 22px;
}

.notification-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    animation: pulse 2s infinite;
}

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

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    z-index: 1001;
}

/* Menu burger (caché par défaut sur desktop) */
.burger-menu {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
}

.burger-menu span {
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    border-radius: 3px;
    transition: all 0.3s;
}

.burger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.burger-menu.active span:nth-child(2) {
    opacity: 0;
}

.burger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.nav-links {
    display: flex;
    gap: 25px;
    align-items: center;
    list-style: none;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--accent);
}

/* Theme Toggle */
.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.theme-toggle:hover {
    background: var(--accent);
    color: white;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 16px;
    transition: border 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Posts */
.post {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.post-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

/* FORCER LA TAILLE DES AVATARS DANS LES POSTS */
.post-header img,
.post img[alt="Avatar"],
img.post-avatar,
.post-avatar,
img[src*="profiles/"] {
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    min-height: 50px !important;
    max-width: 50px !important;
    max-height: 50px !important;
    border-radius: 50% !important;
    margin-right: 15px !important;
    object-fit: cover !important;
    flex-shrink: 0 !important;
    display: block !important;
}

.post-info {
    flex: 1;
}

.post-info h4 {
    margin-bottom: 5px;
}

.post-time {
    color: var(--text-secondary);
    font-size: 14px;
}

.post-content {
    margin-bottom: 15px;
    line-height: 1.6;
}

.post-image {
    width: 100%;
    max-height: 500px;
    border-radius: 8px;
    margin-bottom: 15px;
    object-fit: cover;
}

.post-actions {
    display: flex;
    gap: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.post-actions button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s;
}

.post-actions button:hover {
    color: var(--accent);
}

.post-actions a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
}

.post-actions a:hover {
    color: var(--accent);
}

/* Flash Messages */
.flash-message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

.flash-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

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

/* Responsive */
@media (max-width: 968px) {
    /* Afficher le burger menu */
    .burger-menu {
        display: flex;
    }
    
    /* Menu en mode mobile */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 280px;
        background: var(--bg-card);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        gap: 10px;
        padding: 80px 0 30px 0;
        transition: right 0.3s ease;
        box-shadow: -5px 0 15px var(--shadow);
        z-index: 1000;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .nav-links.active {
        right: 0;
    }
    
    .nav-links li {
        width: 100%;
        text-align: center;
    }
    
    .nav-links a {
        display: block;
        padding: 15px;
        font-size: 18px;
        width: 100%;
    }
    
    .logo {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .navbar .container {
        padding: 0 15px;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .card {
        padding: 15px;
    }
    
    .post {
        padding: 15px;
    }
    
    /* Amélioration pour les images de profil sur mobile */
    .card > div:first-child {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center;
    }
    
    .card > div:first-child > img {
        margin-bottom: 15px;
    }
    
    /* Boutons plus petits sur mobile */
    .btn {
        padding: 8px 16px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 18px;
    }
    
    .card {
        padding: 12px;
    }
    
    .post {
        padding: 12px;
    }
    
    .form-control {
        font-size: 14px;
        padding: 10px;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* ========================================
   BOTTOM NAVIGATION BAR (Mobile)
   ======================================== */
.bottom-nav {
    display: none; /* Caché sur desktop */
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-top: 2px solid var(--border);
        box-shadow: 0 -2px 10px var(--shadow);
        z-index: 999;
        height: 65px;
        padding: 0;
    }
    
    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--text-secondary);
        transition: all 0.3s;
        padding: 8px 0;
        position: relative;
    }
    
    .bottom-nav-item:hover {
        color: var(--accent);
        background: rgba(99, 102, 241, 0.05);
    }
    
    .bottom-nav-item.active {
        color: var(--accent);
        background: rgba(99, 102, 241, 0.1);
    }
    
    .bottom-nav-item.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 3px;
        background: var(--accent);
        border-radius: 0 0 3px 3px;
    }
    
    .bottom-nav-icon {
        font-size: 24px;
        margin-bottom: 2px;
    }
    
    .bottom-nav-label {
        font-size: 11px;
        font-weight: 600;
    }
    
    /* Ajouter du padding en bas du contenu pour éviter que la bottom nav cache le contenu */
    main {
        padding-bottom: 80px !important;
    }
    
    /* Cacher le footer sur mobile quand connecté */
    body:has(.bottom-nav) footer {
        margin-bottom: 65px;
    }
}
