/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4CAF50;
    --primary-dark: #45a049;
    --primary-light: #81C784;
    --primary-gradient: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    --secondary: #2196F3;
    --secondary-dark: #1976D2;
    --danger: #f44336;
    --warning: #ff9800;
    --success: #4CAF50;
    --dark: #1a1a1a;
    --dark-light: #2d2d2d;
    --light: #f8f9fa;
    --light-hover: #e9ecef;
    --white: #ffffff;
    --border: #e0e0e0;
    --border-light: #f0f0f0;
    --text-muted: #6c757d;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    background-attachment: fixed;
    color: var(--dark);
    line-height: 1.6;
    padding-bottom: 80px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 9999;
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

@media (max-width: 767px) {
    .header {
        padding: 0.5rem 1rem;
    }
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-container {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.logo:hover {
    transform: scale(1.05);
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    display: inline;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-name {
    display: inline;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    transition: var(--transition);
    cursor: pointer;
}

.avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    transition: var(--transition);
    animation: fadeInUp 0.4s ease-out;
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-light);
}

.card-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--dark);
    letter-spacing: -0.02em;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 14px rgba(76, 175, 80, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #1976D2;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: 2px solid var(--danger);
}

.btn-danger:hover {
    background: #d32f2f;
    border-color: #d32f2f;
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--white);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
    transform: translateY(-1px);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Posts */
.post {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    transition: var(--transition);
    animation: fadeInUp 0.4s ease-out;
}

.post:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.post-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.post-author {
    font-weight: 600;
    color: var(--dark);
}

.post-date {
    color: #666;
    font-size: 0.875rem;
}

.post-content {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.post-image {
    width: 100%;
    border-radius: var(--radius);
    margin-top: 1rem;
    transition: var(--transition);
    cursor: pointer;
}

.post-image:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-hover);
}

/* Motivations */
.motivation-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    animation: fadeInUp 0.4s ease-out;
    position: relative;
    overflow: hidden;
}

.motivation-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    transition: var(--transition);
}

.motivation-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 16px 48px rgba(102, 126, 234, 0.4);
}

.motivation-card:hover::before {
    top: -30%;
    right: -30%;
}

.motivation-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.motivation-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.motivation-progress {
    background: rgba(255,255,255,0.25);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.3);
}

.progress-bar {
    background: rgba(255,255,255,0.3);
    border-radius: 20px;
    height: 24px;
    margin: 1rem 0;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
    background: linear-gradient(90deg, #ffffff 0%, #f0f0f0 100%);
    height: 100%;
    border-radius: 20px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(255,255,255,0.3);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.palier {
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    border: 1px solid rgba(255,255,255,0.1);
}

.palier:hover {
    background: rgba(255,255,255,0.25);
    transform: translateX(4px);
}

.palier.atteint {
    background: rgba(76, 175, 80, 0.4);
    border-color: rgba(76, 175, 80, 0.6);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

/* Friends */
.friends-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.friend-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    transition: var(--transition);
    animation: fadeInUp 0.4s ease-out;
    text-decoration: none;
    color: inherit;
    display: block;
}

.friend-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.friend-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 0.5rem;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
}

/* Auth pages */
.auth-container {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
}

.auth-card {
    background: var(--white);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-hover);
}

.auth-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--primary);
}

.auth-link {
    text-align: center;
    margin-top: 1.5rem;
    color: #666;
}

.auth-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* Navigation header (desktop) */
.header-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-right: 1rem;
}

.header-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
    color: #666;
    font-size: 0.875rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s;
}

.header-nav-item:hover {
    background: var(--light);
    color: var(--primary);
}

.header-nav-item.active {
    color: var(--primary);
    background: rgba(76, 175, 80, 0.1);
}

.header-nav-item i {
    font-size: 1.25rem;
}

/* Bottom navigation (mobile) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-around;
    padding: 0.75rem;
    z-index: 100;
    border-top: 1px solid var(--border-light);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
    color: #666;
    font-size: 0.75rem;
    transition: color 0.3s;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item i {
    font-size: 1.5rem;
    transition: var(--transition);
}

.nav-item.active i {
    transform: scale(1.1);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    position: relative;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (min-width: 768px) {
    .bottom-nav {
        display: none;
    }
    
    .header-nav {
        display: flex !important;
    }
    
    .friends-list {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 767px) {
    .container {
        padding: 0.5rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .header {
        padding: 0.5rem 1rem;
    }
    
    .header-content {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .logo {
        font-size: 1.25rem;
    }
    
    .logo-text {
        display: none;
    }
    
    .logo-icon {
        font-size: 1.5rem;
    }
    
    .header-nav {
        display: none !important;
    }
    
    .search-container {
        order: 3;
        width: 100%;
        max-width: 100%;
        margin-top: 0;
    }
    
    .nav-user {
        width: auto;
        justify-content: flex-end;
        margin-top: 0;
        gap: 0.5rem;
    }
    
    .user-name {
        display: none;
    }
    
    .notifications-container {
        position: relative;
        z-index: 10001;
    }
    
    .user-info {
        gap: 0;
    }
    
    .btn-small {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
    
    #logoutBtn {
        padding: 0.4rem 0.8rem;
    }
}

/* Filter buttons */
.filter-btn {
    transition: var(--transition);
    border: 2px solid var(--border);
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(76, 175, 80, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.filter-btn:hover {
    background: var(--light-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.filter-btn:hover::before {
    width: 200px;
    height: 200px;
}

.filter-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    transform: translateY(-2px);
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.hidden {
    display: none;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    animation: slideUp 0.3s ease;
    margin: 1rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 10;
    border-radius: 16px 16px 0 0;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--light);
    color: var(--dark);
}

.modal-body {
    padding: 1.5rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 767px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
        margin: 0.5rem;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
}

/* Notifications */
.notifications-container {
    position: relative;
}

.notifications-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 350px;
    max-width: calc(100vw - 2rem);
    max-height: 400px;
    overflow-y: auto;
    z-index: 10000;
    border: 1px solid var(--border-light);
}

@media (max-width: 767px) {
    .notifications-dropdown {
        position: fixed;
        top: 70px;
        left: 0.5rem;
        right: 0.5rem;
        width: auto;
        max-width: none;
        max-height: calc(100vh - 150px);
        margin-top: 0;
        transform: none;
        z-index: 10001;
    }
}

.notification-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition);
}

.notification-item:hover {
    background: var(--light-hover);
}

.notification-item.non-lue {
    background: rgba(76, 175, 80, 0.05);
    border-left: 3px solid var(--primary);
}

.notification-item:last-child {
    border-bottom: none;
}

/* Post actions */
.post-actions {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border-light);
    margin-top: 0.75rem;
}

.btn-like {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 1rem;
    font-weight: 600;
}

.btn-like:hover {
    background: var(--light);
    color: var(--primary);
}

.btn-like.liked {
    color: var(--primary);
}

.btn-like.liked:hover {
    background: rgba(76, 175, 80, 0.1);
}

.btn-motiver {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 1rem;
    font-weight: 600;
}

.btn-motiver:hover {
    background: var(--light);
    color: var(--primary);
}

.btn-commenter {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    transition: var(--transition);
    font-size: 1rem;
    font-weight: 600;
}

.btn-commenter:hover {
    background: var(--light);
    color: var(--primary);
}

.likes-tooltip {
    animation: fadeInUp 0.3s ease-out;
}

.commentaires-section {
    animation: fadeInUp 0.3s ease-out;
}

.commentaire-item {
    transition: var(--transition);
}

.commentaire-item:hover {
    background: var(--light-hover) !important;
}

#notificationBadge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    padding: 0 4px;
}

/* Switch toggle pour les préférences */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: var(--transition);
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background: var(--primary-gradient);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

input:focus + .slider {
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.switch:hover .slider {
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Notification preference items */
.notification-preference-item {
    transition: var(--transition);
}

.notification-preference-item:hover {
    transform: translateX(4px);
}

