@charset "UTF-8";
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #0084ff;
    --secondary-color: #00c6ff;
    --bg-light: #f4f6f9;
    --text-dark: #333;
    --text-light: #666;
    --danger-color: #ff3b30;
    --success-color: #34c759;
    --white: #ffffff;
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    color: var(--text-dark);
}

/* Sidebar HB */
.sidebar {
    width: 280px;
    height: 100vh;
    background: white;
    position: fixed;
    left: 0;
    top: 0;
    padding: 30px;
    box-shadow: 5px 0 20px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.brand {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    list-style: none;
    padding: 0;
    flex: 1;
}

.nav-item {
    margin-bottom: 10px;
}

.nav-item a {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    color: var(--text-light);
    text-decoration: none;
    border-radius: 14px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-item.active a, .nav-item a:hover {
    background: linear-gradient(90deg, rgba(0, 132, 255, 0.1) 0%, rgba(0, 198, 255, 0.05) 100%);
    color: var(--primary-color);
}

.nav-item i {
    margin-right: 15px;
    font-size: 1.2em;
    width: 24px;
    text-align: center;
}

.user-profile {
    display: flex;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.profile-img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    margin-right: 15px;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.user-info h4 {
    margin: 0;
    font-size: 0.95em;
    color: var(--text-dark);
}

.user-info p {
    margin: 0;
    font-size: 0.8em;
    color: var(--text-light);
}

/* Main Content HB */
.main-content {
    margin-left: 280px;
    padding: 40px;
    min-height: 100vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.search-bar {
    display: flex;
    align-items: center;
    background: white;
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: var(--card-shadow);
    width: 350px;
}

.search-bar input {
    border: none;
    outline: none;
    margin-left: 10px;
    width: 100%;
    font-family: inherit;
}

.header-icons {
    display: flex;
    gap: 20px;
}

.icon-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: transform 0.2s;
    color: var(--text-dark);
}

.icon-btn:hover {
    transform: translateY(-2px);
    color: var(--primary-color);
}

/* Dashboard Cards HB */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 160px;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    color: white;
}

.stat-icon.blue { background: linear-gradient(135deg, #0084ff 0%, #00c6ff 100%); }
.stat-icon.purple { background: linear-gradient(135deg, #bd34fe 0%, #41295a 100%); }
.stat-icon.orange { background: linear-gradient(135deg, #ff9966 0%, #ff5e62 100%); }
.stat-icon.green { background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%); }

.stat-info h3 {
    margin: 0 0 5px;
    font-size: 2em;
    font-weight: 700;
}

.stat-info p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.9em;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 15px;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
}

.progress-fill.blue { background: linear-gradient(90deg, #0084ff, #00c6ff); }
.progress-fill.purple { background: linear-gradient(90deg, #bd34fe, #41295a); }
.progress-fill.orange { background: linear-gradient(90deg, #ff9966, #ff5e62); }
.progress-fill.green { background: linear-gradient(90deg, #56ab2f, #a8e063); }

/* Recent Activity HB */
.activity-list {
    list-style: none;
    padding: 0;
}

.activity-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    color: var(--primary-color);
}

.activity-info h5 {
    margin: 0 0 5px;
    font-size: 0.95em;
}

.activity-time {
    font-size: 0.8em;
    color: var(--text-light);
}

/* Navigation Icons HB */
.nav-item-hb {
    padding: 8px 16px;
    border-radius: 20px;
    color: var(--text-light);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.nav-item-hb:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.nav-icon-hb {
    font-size: 1.2rem;
    color: var(--text-light);
    transition: color 0.3s;
}

.nav-item-hb:hover .nav-icon-hb,
.nav-item-hb.active .nav-icon-hb {
    color: var(--primary-color);
}

/* Back Link HB */
.back-link {
    margin-top: 20px;
    text-align: center;
}

.back-link a {
    display: inline-block;
    padding: 10px 20px;
    background: white;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 50px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    font-weight: 600;
    transition: all 0.3s ease;
}

.back-link a:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 132, 255, 0.2);
}

/* Grid Layout for Stories */
/* Grid Layout for Stories - Facebook Style */
.image-stories-section, .video-stories-section {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
    padding: 10px 0;
    margin-bottom: 60px;
}

/* Story Card HB - Facebook Style */
.story-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    border: none;
    display: flex;
    flex-direction: column;
}

.story-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.story-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 5;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%);
    pointer-events: none;
}

.story-header .avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--text-dark);
    border: 3px solid #1877F2; /* Facebook Blue Ring */
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    pointer-events: auto;
}

.story-header .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.story-header .author {
    font-weight: 600;
    color: white;
    font-size: 0.95em;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    pointer-events: auto;
}

.story-header .friendship-actions {
    margin-left: auto;
    pointer-events: auto;
    display: flex;
    gap: 5px;
}

.story-header .btn-small {
    background: rgba(255,255,255,0.25);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.5);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.story-header .btn-small:hover {
    background: white;
    color: #333;
    text-shadow: none;
    transform: scale(1.05);
}

.story-media {
    width: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    aspect-ratio: 9/16; /* Vertical Story Format */
    cursor: pointer;
}

.story-media img, .story-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.story-card:hover .story-media img,
.story-card:hover .story-media video {
    transform: scale(1.05);
}

/* Heart FX Animation */
.heart-fx {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 80px;
    color: white;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
    pointer-events: none;
}

.heart-fx.animate {
    animation: heartPop 0.8s ease-out forwards;
}

@keyframes heartPop {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    30% { transform: translate(-50%, -50%) scale(1.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* Story Actions & Badges - Compact Footer */
form.story-actions {
    display: inline-block;
}

.story-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-light);
    padding: 6px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.story-actions button:hover {
    background: rgba(0,0,0,0.05);
    color: var(--primary-color);
}

.btn-like:hover, .btn-unlike {
    color: var(--danger-color) !important;
}

.btn-unlike:hover {
    background: rgba(255, 59, 48, 0.1) !important;
}

.story-meta {
    padding: 8px 12px;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    border-top: none;
    background: white;
    /* Hide scrollbar */
    scrollbar-width: none;
}

.story-meta::-webkit-scrollbar {
    display: none;
}

.badge {
    font-size: 0.8em;
    padding: 2px 6px;
    border-radius: 4px;
    background: transparent;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.badge:hover {
    background: #f5f5f5;
    transform: none;
}

.badge i {
    font-size: 0.9em;
}

/* Viewer Chips - Hide in grid */
.story-viewers {
    display: none;

    gap: 5px;
}

.viewer-chip {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    padding: 2px 8px 2px 2px;
    border-radius: 12px;
    font-size: 0.8em;
    border: 1px solid #eee;
}

.chip-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    margin-right: 5px;
}

.chip-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.story-text-content {
    margin-top: -80px; /* Pull up into media */
    position: relative;
    z-index: 4;
    pointer-events: none;
    min-height: 80px;
    padding: 15px;
    display: flex;
    align-items: flex-end;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    color: white;
    font-size: 0.95em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.story-text-content a {
    color: #4db5ff; /* Light blue for links on dark bg */
    text-decoration: none;
    pointer-events: auto; /* Allow clicking links */
}

/* Collapsible Sections HB */
.collapsible-section {
    margin-bottom: 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(0,0,0,0.03);
}

.collapsible-header {
    padding: 20px;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to right, #ffffff, #f9f9f9);
}

.collapsible-header h2 {
    font-size: 1.2em;
    margin: 0;
    font-weight: 700;
    color: var(--text-dark);
}

.toggle-icon {
    color: var(--primary-color);
    transition: transform 0.3s;
}

details[open] .toggle-icon {
    transform: rotate(180deg);
}

.collapsible-content {
    padding: 20px;
    border-top: 1px solid rgba(0,0,0,0.05);
    background: #fff;
}

/* ===== MODAL HB STYLE ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.modal-content {
    background-color: #fefefe;
    padding: 0;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.close {
    color: white;
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1010;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    transition: transform 0.2s;
    background: rgba(0,0,0,0.2);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover {
    transform: scale(1.1);
    background: rgba(0,0,0,0.4);
}

.modal-content .close:hover {
    background: rgba(0,0,0,0.1);
}

/* Modal Media (Story View) */
.modal-media {
    background: black;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    min-height: 300px;
    overflow: hidden;
}

.modal-media img, .modal-media video {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.modal-story-info {
    padding: 20px;
    background: white;
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-story-info .author {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--text-dark);
}

.modal-story-info .meta {
    display: flex;
    gap: 15px;
    color: var(--text-light);
    font-size: 0.9em;
}

/* Comments Modal */
.comments-header {
    padding: 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    background: #f9f9f9;
}

.comments-header h3 {
    margin: 0;
    font-size: 1.3em;
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: white;
}

/* Scrollbar for comments list */
.comments-list::-webkit-scrollbar {
    width: 6px;
}

.comments-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.comments-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

.comment-item {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f0f2f5;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.comment-author {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 0.95em;
}

.comment-header-actions {
    display: flex;
    gap: 10px;
}

.comment-delete-btn,
.comment-like-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 5px;
    font-size: 0.9em;
    transition: transform 0.2s, color 0.2s;
}

.comment-delete-btn {
    color: #999;
}

.comment-delete-btn:hover {
    color: #ff3b30;
}

.comment-like-btn {
    color: #999;
    display: flex;
    align-items: center;
    gap: 4px;
}

.comment-like-btn[data-liked="1"] {
    color: #ff3b30;
}

.comment-like-btn:hover {
    transform: scale(1.1);
}

.comment-text {
    color: #444;
    line-height: 1.4;
    margin-bottom: 5px;
    word-wrap: break-word;
}

.comment-date {
    font-size: 0.8em;
    color: #888;
}

.comment-form-container {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.comment-form {
    display: flex;
    gap: 10px;
}

.comment-form input {
    flex: 1;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
    padding: 10px 15px;
    font-family: inherit;
}

.comment-form button {
    border-radius: 20px;
    padding: 8px 20px;
}

/* Toast Notification HB */
.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 50px;
    padding: 16px;
    position: fixed;
    z-index: 2000;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
    visibility: visible;
    opacity: 1;
    bottom: 50px;
}

.toast-success {
    background: linear-gradient(135deg, #34c759 0%, #248a3d 100%);
}

.toast-error {
    background: linear-gradient(135deg, #ff3b30 0%, #c92a21 100%);
}

/* Tabs pour les stories */
.stories-tabs {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 0 15px;
}

.tab-btn {
    background: white;
    border: none;
    padding: 12px 25px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 1rem;
    color: #65676b;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    background: #f0f2f5;
    transform: translateY(-2px);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(0, 132, 255, 0.3);
}

.tab-btn i {
    font-size: 1.1em;
}

/* Section Header HB for Separated Stories */
.section-header-hb {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(0,0,0,0.03);
    position: relative;
}

/* Responsivité Globale */
@media (max-width: 992px) {
    .sidebar {
        width: 80px;
        padding: 20px 10px;
        align-items: center;
    }
    .brand span, .nav-item a span, .user-info {
        display: none;
    }
    .nav-item i {
        margin-right: 0;
        font-size: 1.5em;
    }
    .main-content {
        margin-left: 80px;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 0;
        padding: 0;
        overflow: hidden;
    }
    .main-content {
        margin-left: 0;
        padding: 15px;
    }
    .header {
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
    }
    .search-bar {
        width: 100%;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .image-stories-section, .video-stories-section {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .image-stories-section, .video-stories-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .story-card {
        border-radius: 8px;
    }
    .tab-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
}

.section-header-hb::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background: var(--primary-color);
    border-radius: 2px;
}

.section-header-hb h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-dark);
}

.icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.photo-icon {
    background: linear-gradient(135deg, #FF9966 0%, #FF5E62 100%);
}

/* Story Footer HD */
.story-footer {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #f0f2f5;
}

.story-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #65676b;
    margin-bottom: 12px;
}

.stat-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-text {
    display: flex;
    align-items: center;
    cursor: pointer;
    line-height: 1;
}

.stat-text:hover {
    text-decoration: underline;
}

.stat-icon {
    margin-right: 6px;
}

.like-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: linear-gradient(to bottom, #1877f2, #166fe5);
    color: white;
    border-radius: 50%;
    font-size: 11px;
    border: 1px solid white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.stat-text strong {
    color: #202020;
    font-weight: 600;
    margin-right: 4px;
}

.stat-dot {
    font-weight: bold;
    font-size: 0.8rem;
    color: #b0b3b8;
}

.story-actions-bar {
    display: flex;
    justify-content: space-between; /* Distribute space evenly */
    padding: 4px 0;
    margin-bottom: 12px;
    border-top: 1px solid #ced0d4;
    border-bottom: 1px solid #ced0d4;
}

.action-form {
    flex: 1; /* Each action takes equal width */
    display: flex;
}

.btn-action {
    flex: 1; /* Button fills the form width */
    background: transparent;
    border: none;
    padding: 8px 0;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    color: #65676b;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-action:hover {
    background-color: #f0f2f5;
}

.btn-action.active {
    color: #1877f2; /* Facebook Blue */
}

.btn-action.btn-unlike-action {
    color: #e41e3f; /* Red for Unlike */
}

.btn-action i {
    font-size: 1.1rem;
}

.story-comment-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: #f0f2f5;
    border-radius: 20px;
    padding: 8px 12px;
    transition: background-color 0.2s;
}

.comment-input-wrapper:focus-within {
    background: #e4e6eb;
}

.comment-input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    color: #050505;
}

.comment-input-wrapper input::placeholder {
    color: #65676b;
}

.btn-send {
    background: transparent;
    border: none;
    color: #0084ff;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* message action buttons */
.message-actions {
    margin-top:4px;
    text-align:right;
    opacity:0.6;
    font-size:0.85em;
}
.message-actions span {
    cursor:pointer;
    margin-left:6px;
}
.message-actions span:hover {
    opacity:1;
}

/* quote styling inside messages */
.message-quote {
    margin:4px 0 2px;
    padding-left:6px;
    border-left:2px solid #ccc;
    font-size:0.9em;
    color:#555;
}

/* reply preview box above input */
#replyPreview {
    font-size: 0.9em;
    color: #333;
    background: #f9fafb;
    border-left: 3px solid var(--primary-color);
    padding: 6px 10px;
    margin-bottom: 4px;
    position: relative;
}
#replyPreview span {
    font-weight: bold;
}

.btn-send:hover {
    background-color: rgba(0, 132, 255, 0.1);
}

.btn-send i {
    font-size: 1rem;
}

.video-icon {
    background: linear-gradient(135deg, #56CCF2 0%, #2F80ED 100%);
}

.count-badge {
    background: #f0f0f0;
    color: var(--text-light);
    padding: 2px 10px;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablets et petits écrans (768px et moins) */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
        padding: 15px;
    }

    .brand {
        font-size: 20px;
        margin-bottom: 30px;
        justify-content: center;
    }

    .brand span:not(:first-child) {
        display: none;
    }

    .nav-item a {
        justify-content: center;
        padding: 12px;
    }

    .nav-item i {
        margin-right: 0;
    }

    .user-profile {
        flex-direction: column;
        align-items: center;
    }

    .profile-img {
        margin-right: 0;
        margin-bottom: 10px;
    }

    .user-info {
        text-align: center;
        display: none;
    }

    .main-content {
        margin-left: 70px;
        padding: 20px;
    }

    .search-bar {
        width: 200px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 20px;
    }

    .header-icons {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }

    .stat-card {
        height: auto;
        padding: 15px;
    }

    .stat-info h3 {
        font-size: 1.5em;
    }

    .image-stories-section, .video-stories-section {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .section-header-hb h2 {
        font-size: 1.2rem;
    }

    .modal-content {
        width: 95%;
        max-height: 85vh;
    }
}

/* Mobiles et petits appareils (480px et moins) */
@media (max-width: 480px) {
    /* Hide sidebar, use hamburger menu instead */
    .sidebar {
        width: 0;
        padding: 0;
        overflow: hidden;
        position: fixed;
        left: -100%;
        transition: left 0.3s ease;
        z-index: 1000;
        width: 80%;
        max-width: 280px;
        left: -100%;
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
    }

    .header {
        margin-bottom: 20px;
    }

    .search-bar {
        width: 100%;
        font-size: 0.9em;
    }

    .search-bar input {
        margin-left: 5px;
    }

    .header-icons {
        gap: 10px;
    }

    .icon-btn {
        width: 40px;
        height: 40px;
        font-size: 0.8em;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        height: auto;
        padding: 12px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }

    .stat-info h3 {
        font-size: 1.2em;
    }

    .stat-info p {
        font-size: 0.8em;
    }

    .activity-item {
        padding: 10px 0;
    }

    .activity-icon {
        width: 35px;
        height: 35px;
        margin-right: 10px;
    }

    .story-card {
        border-radius: 8px;
    }

    .image-stories-section, .video-stories-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 40px;
    }

    .story-header {
        padding: 8px;
    }

    .story-header .avatar {
        width: 32px;
        height: 32px;
    }

    .story-header .author {
        font-size: 0.8em;
    }

    .story-media {
        aspect-ratio: 3/4;
    }

    .section-header-hb {
        margin-bottom: 15px;
        padding-bottom: 10px;
        gap: 10px;
    }

    .section-header-hb h2 {
        font-size: 1.1rem;
    }

    .icon-wrapper {
        width: 35px;
        height: 35px;
    }

    .tab-btn {
        padding: 10px 18px;
        font-size: 0.9rem;
    }

    .stories-tabs {
        gap: 10px;
        margin-bottom: 20px;
    }

    .modal {
        padding: 0;
    }

    .modal-content {
        width: 98%;
        max-width: 100%;
        max-height: 95vh;
        border-radius: 15px;
    }

    .close {
        top: 10px;
        right: 10px;
        font-size: 24px;
        width: 36px;
        height: 36px;
    }

    .modal-media {
        min-height: 200px;
    }

    .modal-media img, .modal-media video {
        max-height: 60vh;
    }

    .comments-header h3 {
        font-size: 1.1em;
    }

    .comment-item {
        margin-bottom: 12px;
        padding-bottom: 12px;
    }

    .comment-avatar {
        width: 24px;
        height: 24px;
    }

    .toast {
        min-width: 220px;
        padding: 12px;
        font-size: 0.9em;
    }

    .nav-item-hb {
        padding: 6px 12px;
        font-size: 0.9em;
    }

    .back-link a {
        padding: 8px 16px;
        font-size: 0.9em;
    }

    .collapsible-section {
        margin-bottom: 15px;
    }

    .collapsible-header {
        padding: 15px;
    }

    .collapsible-header h2 {
        font-size: 1em;
    }

    .collapsible-content {
        padding: 15px;
    }
}

/* Extra small devices (320px and up) */
@media (max-width: 360px) {
    .main-content {
        padding: 10px;
    }

    .header {
        margin-bottom: 15px;
    }

    .search-bar {
        padding: 8px 12px;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
    }

    .stats-grid {
        gap: 8px;
    }

    .stat-card {
        padding: 10px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
    }

    .stat-info h3 {
        font-size: 1em;
    }

    .image-stories-section, .video-stories-section {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .story-card {
        border-radius: 6px;
    }

    .modal-content {
        width: 99%;
        margin: 0 5px;
    }

    .tab-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}

/* ===== HAMBURGER MENU ===== */
.hamburger-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    gap: 5px;
    z-index: 999;
}

.hamburger-toggle i {
    font-size: 1.5em;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .hamburger-toggle {
        display: flex;
    }

    .sidebar-toggle {
        display: flex;
    }
}

/* ===== MOBILE OPTIMIZATIONS ===== */

/* Improve touch targets on mobile */
@media (max-width: 768px) {
    button, a[role="button"], .btn-3d, .icon-btn {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    input, textarea, select {
        min-height: 44px;
        font-size: 16px; /* Prevent zoom on iPhone */
    }

    /* Prevent horizontal scroll */
    html, body {
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Improve scroll performance */
    .messages-container, 
    .contacts-list,
    .image-stories-section {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    /* Hide scrollbar while keeping scrolling */
    .contacts-list::-webkit-scrollbar,
    .messages-container::-webkit-scrollbar {
        display: none;
    }

    /* Better spacing for mobile inputs */
    .input-group {
        padding: 10px 0;
    }

    /* Full-width modals on mobile */
    .modal-content {
        max-width: 100vw;
        border-radius: 15px 15px 0 0;
    }

    /* Prevent fixed elements from interfering */
    .modal.show {
        position: fixed;
        backdrop-filter: blur(5px);
    }
}

/* ===== HIGH DPI DISPLAYS ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize for retina displays */
    .story-card,
    .stat-card,
    .modal-content {
        border: 0.5px solid rgba(0,0,0,0.05);
    }
}

/* ===== LANDSCAPE MODE ===== */
@media (max-height: 500px) and (max-width: 900px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 10px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .image-stories-section {
        grid-template-columns: repeat(3, 1fr);
        margin-bottom: 20px;
    }
}

/* Ajustement pour que les sections ne soient pas collées aux tabs */
.image-stories-section,
.video-stories-section {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.stories-page {
    background: var(--bg-light);
}

.stories-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

.stories-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.logo-3d {
    font-weight: 800;
    font-size: 1.6rem;
    background: linear-gradient(90deg, #1877F2, #00C6FF);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.publish-form,
.save-interests-form {
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 16px;
    box-shadow: 0 6px 22px rgba(0,0,0,0.06);
    padding: 18px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.publish-form .form-group,
.save-interests-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.publish-form label,
.save-interests-form label {
    font-weight: 600;
    font-size: 0.95rem;
    color: #202020;
}

.publish-form input[type="text"],
.publish-form select,
.publish-form input[type="file"],
.save-interests-form input[type="text"] {
    border: 1px solid #e4e6eb;
    border-radius: 12px;
    background: #f9fafb;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 0.95rem;
    color: #050505;
    outline: none;
    transition: border-color 0.15s, background-color 0.15s;
}

.publish-form input[type="text"]:focus,
.publish-form select:focus,
.save-interests-form input[type="text"]:focus {
    border-color: #1877F2;
    background-color: #fff;
}

.publish-form input[type="file"] {
    padding: 10px 12px;
    background: #fff;
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-primary {
    background: #1877F2;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(24, 119, 242, 0.2);
    transition: transform 0.1s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
    background: #166fe5;
    box-shadow: 0 10px 20px rgba(24, 119, 242, 0.28);
}

.btn-primary:active {
    transform: translateY(1px);
}

.media-preview {
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 16px;
    padding: 14px;
}

.preview-header {
    font-weight: 700;
    font-size: 0.95rem;
    color: #202020;
    margin-bottom: 8px;
}

.preview-box {
    width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 9/16;
}

.preview-box img,
.preview-box video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-text {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    padding: 16px;
    color: #fff;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 40%, rgba(0,0,0,0.1) 100%);
    font-size: 1rem;
}

.help-text {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--text-light);
}
.alert {
    margin: 12px 0;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

.alert-success {
    background: #e7f3ff;
    color: #1877F2;
    border-color: #bed9ff;
}

.alert-error {
    background: #fde7e9;
    color: #b00020;
    border-color: #f5c2c7;
}
