/* ──────────────────────────────────────────────────────────────
   첨부 목록·레이어의 모양.

   ⚠ 이 파일은 두 벌이다 — view/board/skin/attachment.css 와
     admin/assets/css/attachment.css 는 서로 «짝» 이며 알맹이가 같아야 한다.
     관리자와 손님이 같은 첨부 조각을 쓰므로 모양도 같아야 하고,
     자원은 나눠 쓰지 않으므로 파일은 두 벌이다 (커서룰 §10).
     한쪽만 고치면 그 순간 두 화면이 갈린다.
   ────────────────────────────────────────────────────────────── */

/* ==========================================================================
   DIAL Board Attachments Layout (List / Gallery Toggle) CSS
   ========================================================================== */

/* 1. Attachments Container & Header */
.attachments-wrapper {
    margin-top: 30px;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.attachments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.attachments-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
}

.attachments-title i {
    color: #64748b;
}

/* 2. Layout Toggle Controller */
.layout-toggle-buttons {
    display: inline-flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
    gap: 2px;
}

.toggle-layout-btn {
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.toggle-layout-btn:hover {
    color: #0f172a;
}

.toggle-layout-btn.active {
    background: #ffffff;
    color: #3b82f6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 3. Base List Grid */
.attachment-container {
    transition: all 0.3s ease;
}

/* ==========================================================================
   Layout Mode: List
   ========================================================================== */
.attachment-container.layout-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.attachment-container.layout-list .attachment-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.attachment-container.layout-list .attachment-card:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
    transform: translateY(-1px);
}

.attachment-container.layout-list .card-preview-area {
    display: none !important;
}

.attachment-container.layout-list .card-info-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.attachment-container.layout-list .card-icon-area {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attachment-container.layout-list .card-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-container.layout-list .card-size {
    font-size: 0.85rem;
    color: #94a3b8;
    white-space: nowrap;
    margin-left: 12px;
}

.attachment-container.layout-list .card-action-icon {
    font-size: 0.95rem;
    color: #94a3b8;
    transition: color 0.2s ease;
}

.attachment-container.layout-list .attachment-card:hover .card-action-icon {
    color: #3b82f6;
}

/* ==========================================================================
   Layout Mode: Gallery (작은 아이콘/카드 형태)
   ========================================================================== */
.attachment-container.layout-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.attachment-container.layout-gallery .attachment-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    text-decoration: none;
    overflow: hidden;
    position: relative;
    transition: all 0.2s ease;
    aspect-ratio: 1 / 1;
    cursor: pointer;
}

.attachment-container.layout-gallery .attachment-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

.attachment-container.layout-gallery .card-preview-area {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: #f8fafc;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.attachment-container.layout-gallery .card-preview-area.is-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.attachment-container.layout-gallery .card-icon-large {
    font-size: 2.2rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    margin-bottom: 20px; /* 오버레이 텍스트 공간 확보를 위해 아이콘 위치 상향 조정 */
}

.attachment-container.layout-gallery .attachment-card:hover .card-icon-large {
    transform: scale(1.1);
}

.attachment-container.layout-gallery .card-info-wrap {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 20px 8px 4px 8px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.5) 75%, rgba(0, 0, 0, 0) 100%);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.attachment-container.layout-gallery .card-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0px;
    line-height: 1.2;
}

.attachment-container.layout-gallery .card-size {
    font-size: 0.65rem;
    color: #cbd5e1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    line-height: 1.1;
    margin-top: 1px;
}

/* ==========================================================================
   수정 화면 (Write Mode) 특화 스타일
   ========================================================================== */
.feature-box.attachments-wrapper {
    background: #fffbeb;
    border-left: 5px solid #f59e0b;
    border-top: 1px solid #fef3c7;
    border-right: 1px solid #fef3c7;
    border-bottom: 1px solid #fef3c7;
}

.feature-box .attachments-title {
    color: #b45309;
}

.feature-box .attachments-title i {
    color: #d97706;
}

.feature-box .layout-toggle-buttons {
    background: #fef3c7;
}

.feature-box .toggle-layout-btn {
    color: #b45309;
}

.feature-box .toggle-layout-btn.active {
    background: #ffffff;
    color: #d97706;
}

/* 수정 화면 카드 체크박스 */
.attachment-card-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    margin: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 수정 화면 리스트형 체크박스 배치 */
.attachment-container.layout-list .attachment-card-checkbox {
    position: static;
    margin-right: 10px;
    flex-shrink: 0;
}

.attachment-container.layout-list .attachment-card {
    cursor: pointer;
    user-select: none;
}

/* 삭제 선택 상태 시각 효과 (Write Mode 전용) */
.attachment-card.selected-for-delete {
    border-color: #ef4444 !important;
    background: #fef2f2 !important;
}

.attachment-card.selected-for-delete .card-info-wrap {
    background: transparent !important;
}

.attachment-card.selected-for-delete .card-name {
    color: #fca5a5 !important;
    text-decoration: line-through !important;
}

.attachment-card.selected-for-delete .card-preview-area {
    background-color: rgba(239, 68, 68, 0.08) !important;
}

.attachment-card.selected-for-delete .card-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(239, 68, 68, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.8rem;
    z-index: 5; /* 텍스트 오버레이(z-index: 2)보다 앞에 노출 */
}

/* 반응형 모바일 최적화 */
@media (max-width: 480px) {
    .attachment-container.layout-gallery {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }
    .attachment-container.layout-gallery .card-icon-large {
        font-size: 1.8rem;
    }
    .attachment-container.layout-gallery .card-name {
        font-size: 0.72rem;
    }
}

/* 리스트 모드 전용 요소 제어 (갤러리 모드 시 숨김) */
.attachment-container.layout-gallery .normal-only {
    display: none !important;
}

