/* ============================================
   GENERAL FORUM - MOBILE-FIRST CSS
   ============================================ */

/* ============================================
   BASE STYLES (Mobile First)
   ============================================ */

/* Forum Header Improvements for Mobile */
.forum-header {
    padding: 0 0.5rem;
    position: relative;
}

.forum-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
    position: relative;
}

/* Alert Box Mobile Optimization */
.forum-header .alert {
    font-size: 0.875rem;
    padding: 0.875rem 1.125rem;
    margin: 0 auto 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    background: #ffffff;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

/* ============================================
   CARD STYLES - MOBILE FIRST
   ============================================ */

.card {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    margin-bottom: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

/* Affordance : seules les cartes cliquables (qui portent un stretched-link) ont le curseur "main". */
.card:has(.stretched-link) {
    cursor: pointer;
}

.card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
    transform: translateY(-4px);
    border-color: #d1d5db;
}

/* Card Body Layout - Mobile */
.card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: transparent;
    position: relative;
    z-index: 1;
}

/* ============================================
   ICON & CONTENT LAYOUT
   ============================================ */

.card-body > .d-flex:first-child {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.icon-container {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    border-radius: 12px;
    margin: 0;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

.card:hover .icon-container {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.icon-full-height {
    font-size: 1.6rem;
    margin: 0;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.card:hover .icon-full-height {
    transform: scale(1.1);
}

.content {
    flex: 1;
    min-width: 0; /* Prevent overflow */
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    letter-spacing: -0.2px;
}

.card-title a {
    color: #1a1a1a;
    text-decoration: none;
    display: block;
    transition: color 0.2s ease;
}

.card:hover .card-title a {
    color: var(--primary-color, #007bff);
}

.card-text.description {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   STATS SECTION - MOBILE OPTIMIZED
   ============================================ */

.stats {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    background: #f9fafb;
    padding: 1rem 0.75rem;
    border-radius: 12px;
    margin-top: 0.75rem;
    width: 100%;
    min-width: auto;
    border: 1px solid #e5e7eb;
    position: relative;
}

.subjects,
.replies,
.last-activity {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    min-width: 0;
    margin: 0;
    position: relative;
    padding: 0.25rem;
}

.subjects::after,
.replies::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 60%;
    background: #e5e7eb;
}

/* Icon Styling */
.icon-subject,
.icon-reply,
.icon-activity {
    font-size: 1.25rem;
    color: var(--primary-color, #6b7280);
    margin: 0 0 0.35rem 0;
    opacity: 0.8;
    transition: all 0.2s ease;
}

/* Stats Content */
.subjects .forum,
.replies .forum,
.last-activity > span {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
}

.count {
    font-size: 1.375rem;
    font-weight: 800;
    background: linear-gradient(135deg, #0066ff 0%, #00a8ff 50%, #0066ff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    letter-spacing: -0.8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
    position: relative;
}

.count::after {
    content: attr(data-count);
    position: absolute;
    top: 0;
    left: 0;
    background: linear-gradient(135deg, #0066ff 0%, #00a8ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover .count {
    transform: scale(1.1);
    background-position: 100% center;
}

.label {
    font-size: 0.7rem;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    opacity: 0.85;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.card:hover .label {
    opacity: 1;
    color: #495057;
    transform: translateY(-1px);
}

/* Last Activity Specific */
.last-activity > span {
    font-size: 0.75rem;
    color: #6c757d;
    line-height: 1.3;
    max-width: 90px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.card:hover .last-activity > span {
    color: #495057;
    transform: translateY(-1px);
}

/* ============================================
   BREADCRUMB MOBILE OPTIMIZATION
   ============================================ */

.forum-breadcrumb {
    padding: 0.875rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
}

.forum-breadcrumb .breadcrumb-item {
    font-size: 0.875rem;
    font-weight: 500;
}

/* ============================================
   CONTAINER ADJUSTMENTS
   ============================================ */

@media (max-width: 767px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .container.my-5 {
        margin-top: 1.5rem;
        margin-bottom: 1.5rem;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

@keyframes floatShadow {
    0%, 100% {
        box-shadow: 
            0 10px 40px -10px rgba(0, 123, 255, 0.08),
            0 4px 20px rgba(0, 0, 0, 0.06);
    }
    50% {
        box-shadow: 
            0 12px 45px -12px rgba(0, 123, 255, 0.1),
            0 6px 24px rgba(0, 0, 0, 0.08);
    }
}

.card {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }
.card:nth-child(7) { animation-delay: 0.35s; }
.card:nth-child(8) { animation-delay: 0.4s; }
.card:nth-child(9) { animation-delay: 0.45s; }
.card:nth-child(10) { animation-delay: 0.5s; }

/* ============================================
   EXTRA SMALL SCREENS (< 576px)
   ============================================ */

@media (max-width: 575px) {
    .forum-header h1 {
        font-size: 1.5rem;
    }
    
    .card {
        border-radius: 14px;
    }
    
    .card-body {
        padding: 1rem;
        gap: 0.875rem;
    }
    
    .icon-container {
        width: 48px;
        height: 48px;
        border-radius: 12px;
    }
    
    .icon-full-height {
        font-size: 1.4rem;
    }
    
    .card-title {
        font-size: 1.05rem;
    }
    
    .card-text.description {
        font-size: 0.8125rem;
        line-height: 1.5;
    }
    
    .stats {
        padding: 0.875rem 0.5rem;
        border-radius: 12px;
        margin-top: 0.5rem;
    }
    
    .icon-subject,
    .icon-reply,
    .icon-activity {
        font-size: 1.2rem;
        margin-bottom: 0.25rem;
    }
    
    .count {
        font-size: 1.2rem;
    }
    
    .label {
        font-size: 0.65rem;
        letter-spacing: 0.6px;
    }
    
    .last-activity > span {
        font-size: 0.65rem;
        max-width: 75px;
    }
    
    .forum-breadcrumb {
        padding: 0.75rem 1rem;
        border-radius: 12px;
    }
}

/* ============================================
   TABLET & DESKTOP (min-width: 768px)
   Preserve original desktop layout
   ============================================ */

@media (min-width: 768px) {
    /* Reset to desktop layout */
    .card {
        border-radius: 16px;
    }
    
    .card-body {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1.5rem;
        gap: 1.5rem;
    }
    
    .card-body > .d-flex:first-child {
        flex: 1;
        align-items: center;
    }
    
    .icon-container {
        width: 54px;
        height: 54px;
        background: #f9fafb;
        border-radius: 12px;
    }
    
    .icon-full-height {
        font-size: 2rem;
    }
    
    .content {
        flex: 1;
    }
    
    .card-title {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }
    
    .card-text.description {
        font-size: 0.9375rem;
        -webkit-line-clamp: unset;
    }
    
    /* Stats back to vertical column layout for desktop */
    .stats {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        background: transparent;
        padding: 0;
        border-radius: 0;
        margin-top: 0;
        flex-basis: 22%;
        min-width: 22%;
        box-shadow: none;
        border: none;
    }
    
    .subjects,
    .replies,
    .last-activity {
        flex-direction: row;
        align-items: center;
        text-align: left;
        margin-bottom: 0.65rem;
        padding: 0;
    }
    
    .subjects::after,
    .replies::after {
        display: none;
    }
    
    .subjects:hover,
    .replies:hover,
    .last-activity:hover {
        transform: translateX(3px);
    }
    
    .icon-subject,
    .icon-reply,
    .icon-activity {
        font-size: 1.1rem;
        margin-right: 0.625rem;
        margin-bottom: 0;
        opacity: 0.85;
    }
    
    .subjects .forum,
    .replies .forum {
        flex-direction: row;
        gap: 0.375rem;
        align-items: baseline;
    }
    
    .count {
        font-size: 1.125rem;
        font-weight: 700;
    }
    
    .label {
        font-size: 0.875rem;
        text-transform: none;
        letter-spacing: normal;
        display: inline;
        font-weight: 500;
    }
    
    .last-activity > span {
        font-size: 0.875rem;
        flex-direction: row;
        max-width: none;
        font-weight: 500;
    }
    
    .forum-header h1 {
        font-size: 2.5rem;
    }
}

/* ============================================
   LARGE DESKTOP (min-width: 1200px)
   ============================================ */

@media (min-width: 1200px) {
    .card {
        border-radius: 16px;
        margin-bottom: 1.25rem;
    }
    
    .card-body {
        padding: 2rem;
    }
    
    .icon-container {
        width: 60px;
        height: 60px;
        border-radius: 14px;
    }
    
    .icon-full-height {
        font-size: 2.25rem;
    }
    
    .card-title {
        font-size: 1.2rem;
    }
    
    .card-text.description {
        font-size: 0.95rem;
    }
    
    .forum-header h1 {
        font-size: 2rem;
    }
    
    .forum-breadcrumb {
        padding: 1rem 1.5rem;
        border-radius: 14px;
    }
}

/* ============================================
   ACCESSIBILITY & INTERACTIONS
   ============================================ */

/* Touch-friendly targets on mobile */
@media (max-width: 767px) {
    .card-title a {
        padding: 0.25rem 0;
        display: inline-block;
    }
    
    /* Ensure sufficient tap target size */
    .card {
        position: relative;
    }
    
    .card-title .stretched-link::after {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1;
        content: "";
    }
    
    /* Active state for touch */
    .card:active {
        transform: translateY(-1px) scale(0.99);
        transition: transform 0.1s ease;
    }
}

/* Focus styles for accessibility */
.card-title a:focus-visible {
    outline: 2px solid var(--primary-color, #007bff);
    outline-offset: 4px;
    border-radius: 4px;
}

/* Smooth scrolling for mobile */
@media (max-width: 767px) {
    html {
        scroll-behavior: smooth;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
        transition-duration: 0.01ms;
    }
}

