/**
 * Accordion Components
 * 
 * Project accordion for organizing estimates, jobs, and invoices.
 * Uses jQuery slideToggle for smooth animations with localStorage state persistence.
 * 
 * CRITICAL: Uses .expanded class + jQuery slideDown/slideUp for animations.
 * CSS display property is managed by JavaScript, not static CSS.
 * 
 * @package Silva_Customer_Portal
 * @version 2.6.0
 */

/* ========================================
   PROJECT ACCORDION STRUCTURE
   ======================================== */

.project-accordion-section {
    background: transparent;
    border: none;
    border-radius: 0;
    margin-bottom: 20px;
    overflow: visible;
    box-shadow: none;
    transition: all 0.2s ease;
}

.project-accordion-section:hover {
    box-shadow: none;
}

/* ========================================
   ACCORDION HEADER
   ======================================== */

.accordion-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    min-height: 64px;
    cursor: pointer;
    user-select: none;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
}

/* Mobile expand hint */
.accordion-header::after {
    content: 'Click to expand';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: #9ca3af;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

@media (max-width: 768px) {
    .accordion-header:not(:hover)::after {
        opacity: 0.6;
    }
}

/* Hover and active states */
.accordion-header:hover {
    background-color: #fafbfc;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(1, 67, 133, 0.08);
    transform: translateY(-1px);
}

.accordion-header:active {
    transform: translateY(0);
}

.accordion-header:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

/* ========================================
   ACCORDION HEADER ELEMENTS
   ======================================== */

.accordion-icon {
    font-size: 28px;
    flex-shrink: 0;
    line-height: 1;
}

.accordion-title {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    letter-spacing: -0.01em;
}

.accordion-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background: #3b82f6;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    border-radius: 18px;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
}

.accordion-chevron {
    flex-shrink: 0;
    color: #9ca3af;
    transition: transform 0.2s ease;
    font-size: 14px;
}

/* Mobile - larger chevron for better visibility */
@media (max-width: 768px) {
    .accordion-chevron {
        font-size: 20px;
    }
}

.project-accordion-section.expanded .accordion-chevron {
    transform: rotate(180deg);
}

/* ========================================
   ACCORDION BODY (JavaScript-Managed)
   ======================================== */

/**
 * IMPORTANT: The accordion-body display is controlled by JavaScript using jQuery's
 * slideUp() and slideDown() methods. Do NOT set display: none here as it will
 * conflict with jQuery's animation system.
 * 
 * The .expanded class is a marker for state tracking only. The actual show/hide
 * animation is handled by projects-accordion.js using:
 * - $(body).slideDown(300) when expanding
 * - $(body).slideUp(300) when collapsing
 */

.accordion-body {
    overflow: hidden;
    padding: 0;
    background: transparent;
}

/* When expanded, add spacing (JavaScript will handle display) */
.project-accordion-section.expanded .accordion-body {
    padding: 16px 0;
}

/* Card spacing within accordion */
.accordion-body > .project-card:first-child {
    margin-top: 0;
}

.accordion-body > .project-card {
    margin-bottom: 16px;
}

.accordion-body > .project-card:last-child {
    margin-bottom: 0;
}

/* Empty state */
.accordion-body .empty-state-inline {
    padding: 32px 24px;
    text-align: center;
    color: #6b7280;
    font-size: 15px;
}

.accordion-body .empty-state-inline p {
    margin: 0;
}
