/*--------------------------------------------------------------
# Dashboard Logbook - Minimalist Professional Design
--------------------------------------------------------------*/

/* Card Container */
.card-logbook {
    transition: all 0.3s ease;
}

/* Accordion Container */
.accordion {
    margin-bottom: 0.5rem;
}

/* Accordion Item */
.accordion-item {
    border: 1px solid #e5e7eb !important;
    margin-bottom: 0.375rem;
    border-radius: 10px !important;
    overflow: hidden;
    background: white;
    transition: all 0.2s ease;
}

.accordion-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Accordion Theme Header */
.accordion-button {
    font-size: 0.9375rem;
    padding: 1rem 1.25rem;
    transition: all 0.2s ease;
    border: none !important;
    background: white !important;
    color: #1f2937 !important;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.accordion-button i.bi-folder2-open {
    font-size: 1.125rem;
    color: #6b7280;
    transition: color 0.2s ease;
}

.accordion-button:not(.collapsed) {
    background: #f9fafb !important;
    border-bottom: 1px solid #e5e7eb;
}

.accordion-button:not(.collapsed) i.bi-folder2-open {
    color: #4f46e5;
}

.accordion-button::after {
    width: 0.875rem;
    height: 0.875rem;
    background-size: 0.875rem;
    margin-left: 1rem;
    flex-shrink: 0;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.accordion-button:hover::after {
    opacity: 0.7;
}

.accordion-button:not(.collapsed)::after {
    filter: none;
    opacity: 0.7;
    transform: rotate(-180deg);
}

.accordion-button:not(.collapsed) .badge {
    background-color: white !important;
    color: #4f46e5 !important;
    border: 1px solid #e0e7ff;
}

.accordion-button:not(.collapsed) .badge.bg-warning {
    background-color: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #fde68a;
}

.accordion-button.collapsed:hover {
    background: #fafafa !important;
}

.accordion-button:hover i.bi-folder2-open {
    color: #4f46e5;
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(65, 84, 241, 0.25);
}

/* Module List Improvements */
.scrollable-modules {
    max-height: 600px;
    overflow-y: auto;
    padding: 10px 0 0 0;
}

.scrollable-modules .list-group {
    margin-bottom: 0;
}

.scrollable-modules::-webkit-scrollbar {
    width: 6px;
}

.scrollable-modules::-webkit-scrollbar-track {
    background: transparent;
}

.scrollable-modules::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.scrollable-modules::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Module List Items */
.list-group-item {
    border: none;
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.15s ease;
    padding: 0.875rem 1.25rem;
    margin-bottom: 0;
    border-radius: 0;
    background: white;
    position: relative;
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item:hover {
    background: #fafafa;
}

.list-group-item span:first-child {
    font-weight: 500;
    font-size: 0.75rem;
}

/* Module with Tutor Comment */
.list-group-item.bg-primary-subtle {
    background: #fffbeb !important;
    border-left: 3px solid #f59e0b;
    border-bottom-color: #fef3c7;
    position: relative;
    padding-left: 2.25rem;
}

.list-group-item.bg-primary-subtle::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #f59e0b;
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
    z-index: 1;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
    50% {
        opacity: 0.6;
        transform: translateY(-50%) scale(1.2);
    }
}

/* Module Validated */
.list-group-item.bg-success-subtle {
    background: #f0fdf4 !important;
    border-left: 3px solid #10b981;
    border-bottom-color: #d1fae5;
}

/* Badges */
.badge {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    letter-spacing: 0.025em;
    border-radius: 6px;
    text-transform: uppercase;
}

.badge.bg-success {
    background: #10b981 !important;
    color: white;
}

.badge.bg-primary {
    background: #4f46e5 !important;
    color: white;
}

.badge.bg-warning {
    background: #f59e0b !important;
    color: white;
    position: relative;
}

.badge i {
    font-size: 0.75rem;
    margin-right: 0.25rem;
}

/* Buttons */
.btn-sm {
    font-size: 0.8125rem;
    padding: 0.375rem 0.875rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.15s ease;
    border-width: 1px;
}

.btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-sm:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-sm i {
    font-size: 0.875rem;
}

.btn-primary {
    background: #4f46e5;
    border-color: #4f46e5;
    color: white;
}

.btn-primary:hover {
    background: #4338ca;
    border-color: #4338ca;
}

.btn-outline-primary {
    border-color: #e0e7ff;
    color: #4f46e5;
    background: white;
}

.btn-outline-primary:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #4338ca;
}

.btn-outline-success {
    border-color: #d1fae5;
    color: #10b981;
    background: white;
}

.btn-outline-success:hover {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #059669;
}

.btn-outline-secondary {
    border-color: #e5e7eb;
    color: #6b7280;
    background: white;
}

.btn-outline-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #4b5563;
}

/* Accordion Body */
.accordion-body {
    padding: 0;
    background-color: #fafafa;
}

/* Empty State */
.card-logbook .glitch-text {
    font-size: 2rem;
    animation: glitch 3s infinite;
}

@keyframes glitch {
    0%, 100% {
        text-shadow: 2px 2px 0 rgba(65, 84, 241, 0.3);
    }
    50% {
        text-shadow: -2px -2px 0 rgba(65, 84, 241, 0.3);
    }
}

/* Responsive Design */
@media (max-width: 767.98px) {
    .accordion-button {
        font-size: 0.9rem;
        padding: 0.875rem 1rem;
        flex-wrap: wrap;
    }
    
    .accordion-button span {
        font-size: 0.875rem;
    }
    
    /* Forcer le passage à la ligne des badges sur tablette */
    .accordion-button > .d-flex.align-items-center.gap-3 {
        flex-wrap: wrap;
        gap: 0.5rem !important;
        margin-top: 0.5rem;
        width: 100%;
    }
    
    .accordion-button > .d-flex.align-items-center.gap-3 > div {
        font-size: 0.8rem;
    }
    
    .accordion-button > .d-flex.align-items-center.gap-3 small {
        font-size: 0.7rem;
    }
    
    .scrollable-modules {
        max-height: 400px;
    }
    
    .list-group-item {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
    }
    
    .list-group-item .d-flex {
        width: 100%;
        justify-content: flex-start;
    }
    
    .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Responsive pour petits smartphones (≤480px) */
@media (max-width: 480px) {
    .accordion-button {
        font-size: 0.85rem;
        padding: 0.75rem 0.875rem;
    }
    
    /* Affichage vertical des badges */
    .accordion-button > .d-flex.align-items-center.gap-3 {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.375rem !important;
        margin-top: 0.5rem;
        width: 100%;
    }
    
    .accordion-button > .d-flex.align-items-center.gap-3 > div {
        width: 100%;
    }
    
    .accordion-button > .d-flex.align-items-center.gap-3 small {
        font-size: 0.65rem;
        min-width: 70px;
    }
    
    .accordion-button > .d-flex.align-items-center.gap-3 .badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }
    
    .badge i {
        font-size: 0.7rem;
    }
}

/* Print Styles */
@media print {
    .accordion-button {
        background: white !important;
        color: black !important;
    }
    
    .scrollable-modules {
        max-height: none;
        overflow: visible;
    }
}
