/**
 * Frontend styles for Documents Accordion.
 */

.da-wrapper {
    max-width: 100%;
    margin: 2rem 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: var(--da-text);
}

/* --- Search Bar --- */
.da-search-bar {
    margin-bottom: 1.5rem;
}

.da-search-inner {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--da-radius);
    padding: 0 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.da-search-inner:focus-within {
    border-color: var(--da-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.da-search-inner svg {
    color: #94a3b8;
    margin-right: 0.75rem;
}

.da-search-input {
    flex: 1;
    border: none !important;
    padding: 0.75rem 0 !important;
    font-size: 1rem !important;
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
}

.da-search-clear {
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    font-size: 12px;
    margin-left: 0.5rem;
}

.da-search-clear:hover {
    background: #e2e8f0;
}

/* --- Accordion Levels --- */
.da-accordion {
    border: 1px solid #e2e8f0;
    border-radius: var(--da-radius);
    overflow: hidden;
    background: #fff;
}

/* Year Level */
.da-year-item {
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

.da-year-item:last-child {
    border-bottom: none;
}

.da-year-btn {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: #fff;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.da-year-btn:hover {
    background: var(--da-secondary);
    padding-left: 1.75rem; /* Subtle slide effect */
}

.da-year-icon {
    color: var(--da-primary);
    margin-right: 1.25rem;
    display: flex;
    background: #eff6ff;
    padding: 8px;
    border-radius: 8px;
}

.da-year-label {
    font-size: 1.25rem;
    font-weight: 700;
    flex: 1;
    color: #1e293b;
}

.da-badge {
    background: #f1f5f9;
    color: #475569;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    margin: 0 1rem;
}

.da-chevron {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #94a3b8;
}

.da-year-btn[aria-expanded="true"] {
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}

.da-year-btn[aria-expanded="true"] .da-chevron {
    transform: rotate(180deg);
}

.da-year-panel {
    background: #f8fafc;
}

/* Dept Level */
.da-dept-item {
    border-bottom: 1px solid #f1f5f9;
}

.da-dept-item:last-child {
    border-bottom: none;
}

.da-dept-btn {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem 1rem 4.5rem; /* Indented from Year */
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.da-dept-btn:hover {
    background: #fff;
    padding-left: 4.75rem;
}

.da-dept-icon {
    color: #64748b;
    margin-right: 1rem;
    display: flex;
}

.da-dept-label {
    font-size: 1.05rem;
    font-weight: 600;
    flex: 1;
    color: #334155;
}

.da-badge--dept {
    background: transparent;
    border: 1px solid #e2e8f0;
    font-size: 0.75rem;
}

.da-dept-btn[aria-expanded="true"] {
    background: #fff;
    color: var(--da-primary);
}

.da-dept-btn[aria-expanded="true"] .da-chevron {
    transform: rotate(180deg);
}

.da-dept-panel {
    background: #fff;
    border-top: 1px solid #f1f5f9;
}

/* Doc List */
.da-doc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.da-doc-item {
    border-bottom: 1px dotted #f1f5f9;
}

.da-doc-item:last-child {
    border-bottom: none;
}

.da-doc-container {
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

.da-doc-container:hover {
    background: #f8fafc;
}

.da-doc-link {
    display: flex;
    align-items: flex-start;
    padding: 1.25rem 1rem 1.25rem 6.5rem; /* Further indented */
    text-decoration: none !important;
    flex: 1;
}

.da-doc-icon {
    margin-right: 1.25rem;
    flex-shrink: 0;
}

.da-file-icon {
    width: 32px;
    height: auto;
}

.da-doc-body {
    flex: 1;
}

.da-doc-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--da-text);
    margin-bottom: 0.25rem;
}

.da-icon-eye {
    color: var(--da-primary);
    opacity: 0.5;
    transition: opacity 0.2s;
}

.da-doc-link:hover .da-icon-eye {
    opacity: 1;
}

.da-doc-desc {
    display: block;
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.da-doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: #94a3b8;
    align-items: center;
}

.da-doc-badge {
    background: #f1f5f9;
    color: #475569;
    padding: 1px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.da-type-compte-rendu { background: #dcfce7; color: #166534; }
.da-type-budget       { background: #fef9c3; color: #854d0e; }
.da-type-pv           { background: #e0f2fe; color: #075985; }
.da-type-rapport      { background: #f3e8ff; color: #6b21a8; }

/* Actions */
.da-doc-actions {
    padding-right: 1.5rem;
}

.da-btn-download {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #64748b;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none !important;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
}

.da-btn-download:hover {
    border-color: var(--da-primary);
    color: var(--da-primary);
    background: #eff6ff;
}

.da-btn-download svg {
    color: var(--da-primary);
}

@media (max-width: 640px) {
    .da-btn-text { display: none; }
    .da-btn-download { padding: 8px; border-radius: 50%; }
}

/* Utils */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

.da-no-results {
    padding: 2rem;
    text-align: center;
    color: #64748b;
}

[hidden] {
    display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
    .da-year-btn { padding: 1rem; }
    .da-dept-btn { padding: 0.75rem 1rem 0.75rem 1.5rem; }
    .da-doc-link { padding: 1rem 1rem 1rem 2rem; }
    .da-doc-meta { gap: 0.5rem; }
}
