/* ────────────────────────────────────────────────────────────────────────────
   AIM Frontend CSS  –  Additional Information Modal
   Matches screenshot: white modal, pill tabs, 3-col file grid, right preview
   ─────────────────────────────────────────────────────────────────────────── */

/* ── Modal backdrop ──────────────────────────────────────────────────────── */
.aim-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999990;
    align-items: center;
    justify-content: center;
}
.aim-modal.aim-show { display: flex; }

/* Body scroll lock */
body.aim-body-lock { overflow: hidden !important; }

/* Dark overlay */
.aim-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.60);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

/* ── Modal container ─────────────────────────────────────────────────────── */
.aim-container {
    position: relative;
    z-index: 1;
    width: 88vw;
    max-width: 1140px;
    height: 82vh;
    max-height: 820px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: aimFadeUp .22s ease;
}

@keyframes aimFadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.aim-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 26px 16px;
    border-bottom: 1px solid #efefef;
    flex-shrink: 0;
}

.aim-header h2 {
    margin: 0 !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #111 !important;
    line-height: 1.3 !important;
}

.aim-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: opacity .15s;
    flex-shrink: 0;
}
.aim-close:hover { opacity: .6; }

/* ── Tab navigation ──────────────────────────────────────────────────────── */
.aim-tab-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 26px;
    border-bottom: 1px solid #efefef;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}
.aim-tab-nav::-webkit-scrollbar { display: none; }

/* Ensure buttons don't stretch / shrink in the flex row */
.aim-tab-nav .aim-tab-pill {
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Body (left panels + right preview) ──────────────────────────────────── */
.aim-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ── Left: scrollable tab panels ─────────────────────────────────────────── */
.aim-panels {
    flex: 1;
    overflow-y: auto;
    padding: 20px 26px;
    border-right: 1px solid #efefef;
    min-width: 0;
}

/* Tab panel show/hide */
.aim-panel          { display: none; }
.aim-panel.aim-active { display: block; }

/* ── Group section ───────────────────────────────────────────────────────── */
.aim-group { margin-bottom: 28px; }

.aim-group-name {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #111 !important;
    margin: 0 0 12px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid #efefef !important;
}

/* ── Files grid (3 columns, matching screenshot) ─────────────────────────── */
.aim-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* File item card */
.aim-item {
    cursor: pointer;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    background: #f5f5f5;
    transition: border-color .15s, transform .12s;
    outline: none;
}
.aim-item:hover  { border-color: #999; transform: translateY(-1px); }
.aim-item:focus  { border-color: #1a1a1a; box-shadow: 0 0 0 3px rgba(26,26,26,.15); }
.aim-item.aim-selected {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 3px rgba(26,26,26,.12);
}

/* Thumbnail area */
.aim-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8e8e8;
}
.aim-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .2s;
}
.aim-item:hover .aim-thumb img { transform: scale(1.05); }

/* PDF thumb */
.aim-item--pdf .aim-thumb { background: #fff3f3; }
.aim-item--pdf .aim-thumb svg { width: 48px; height: 60px; }

/* File label under thumb */
.aim-label {
    display: block;
    font-size: 11px;
    color: #555;
    padding: 5px 7px;
    background: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-top: 1px solid #eee;
}

/* ── Right: Preview panel ─────────────────────────────────────────────────── */
.aim-preview {
    width: 55%;          /* preview lebih lebar dari panels (45%) */
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

.aim-preview-title {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #111 !important;
    margin: 0 0 12px !important;
}

.aim-preview-content { flex: 1; }

.aim-preview-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    border: 2px dashed #e0e0e0;
    border-radius: 10px;
    color: #bbb;
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

/* Full image preview */
.aim-prev-img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    display: block;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.10);
}

/* PDF iframe preview */
.aim-prev-pdf {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.aim-prev-pdf iframe {
    width: 100%;
    height: 380px;
    border-radius: 8px;
    border: 1px solid #eee;
}
.aim-prev-pdf-link {
    display: inline-block;
    font-size: 13px;
    color: #1a1a1a;
    text-decoration: underline;
    font-weight: 600;
}
.aim-prev-pdf-link:hover { opacity: .7; }

/* ── Scrollbar styling ───────────────────────────────────────────────────── */
.aim-panels::-webkit-scrollbar,
.aim-preview::-webkit-scrollbar { width: 5px; }
.aim-panels::-webkit-scrollbar-track,
.aim-preview::-webkit-scrollbar-track { background: transparent; }
.aim-panels::-webkit-scrollbar-thumb,
.aim-preview::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .aim-container  { width: 95vw; height: 90vh; max-height: none; }

    /* Body: column, panels scroll — preview always pinned at bottom */
    .aim-body {
        flex-direction: column;
        overflow: hidden;   /* body itself does NOT scroll */
    }

    /* Panels scroll independently, take all available space above preview */
    .aim-panels {
        flex: 1;
        min-height: 0;          /* crucial for flex shrink + scroll to work */
        overflow-y: auto;
        border-right: none;
        border-bottom: 1px solid #efefef;
    }

    /* Preview: always visible, pinned at bottom of modal, fixed height */
    .aim-preview {
        width: 100%;
        flex-shrink: 0;
        height: 220px;          /* always visible regardless of scroll position */
        overflow-y: auto;
        border-top: 1px solid #efefef;
        padding: 14px 16px;
    }

    /* Tighten preview title spacing on mobile */
    .aim-preview-title { margin: 0 0 8px !important; }

    /* Preview image fills the fixed-height area neatly */
    .aim-prev-img {
        width: auto;
        max-width: 100%;
        max-height: 160px;
        object-fit: contain;
        margin: 0 auto;
        display: block;
    }

    /* PDF iframe smaller on mobile */
    .aim-prev-pdf iframe { height: 140px; }

    .aim-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .aim-grid       { grid-template-columns: repeat(2, 1fr); }
    .aim-tab-nav    { gap: 6px; }
    .aim-tab-pill   { font-size: 12px; padding: 6px 14px; }
    .aim-header h2  { font-size: 17px !important; }
    .aim-container  { border-radius: 12px; }
}

/* ── Sign-In Required Modal ──────────────────────────────────────────────── */
#aim-signin-modal .aim-signin-card {
    position: relative;
    z-index: 1;
    width: 90vw;
    max-width: 460px;
    background: #fff;
    border-radius: 20px;
    padding: 44px 32px 36px;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
    animation: aimFadeUp .22s ease;
}

/* Close button — top-right of card */
#aim-signin-modal .aim-signin-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: opacity .15s;
}
#aim-signin-modal .aim-signin-close:hover { opacity: .6; }

/* Lock icon circle */
.aim-signin-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}
.aim-signin-icon img {
    display: block;
}

/* Heading */
#aim-signin-modal h2 {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #111 !important;
    margin: 0 0 14px !important;
    line-height: 1.3 !important;
}

/* Description */
#aim-signin-modal p {
    font-size: 15px !important;
    color: #555 !important;
    line-height: 1.6 !important;
    margin: 0 0 28px !important;
}

/* Sign In button — uses theme class black-button full-rounded + inline width:100% */
#aim-signin-modal .black-button {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    text-decoration: none !important;
    box-sizing: border-box;
}