/* imgstorage 게시판 전용 */

#bo_list.imgstorage_list {
    width: 90%;
}

.imgstorage_top_row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 8px;
}

.imgstorage_upload_wrap {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
    padding: 0 10px;
    flex-wrap: wrap;
}

.imgstorage_uploadimg {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
    min-width: 200px;
    text-align: left;
    flex-wrap: wrap;
}

.imgstorage_category_buttons {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.imgstorage_category_buttons a.imgstorage_category_btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    min-height: 30px;
    padding: 4px 10px;
    line-height: 1;
    font-weight: 600;
    text-decoration: none;
    user-select: none;
    border: 1px solid var(--btn-secondary-bg, #666);
    background: var(--btn-secondary-bg, #666);
    color: var(--btn-secondary-text, #fff);
    border-radius: var(--btn-secondary-radius, 4px);
}

.imgstorage_category_buttons a.imgstorage_category_btn:hover {
    opacity: 0.9;
}

.imgstorage_category_search_area {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 10px;
    margin-left: auto;
    align-items: flex-end;
}
.imgstorage_category_search_area .imgstorage_search_wrap {
    margin-top: 0;
    padding: 0;
}
.imgstorage_category_search_area .imgstorage_category_buttons + .imgstorage_search_wrap {
    margin-top: 12px;
}
.imgstorage_search_wrap {
    padding: 0;
}
.imgstorage_search_form {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 320px;
}
.imgstorage_search_input {
    flex: 1;
    min-width: 0;
    height: 32px;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}
.imgstorage_search_input:focus {
    outline: none;
    border-color: var(--secondary-color, #666);
}
.imgstorage_search_btn {
    flex-shrink: 0;
    height: 32px;
    padding: 0 16px;
    border: none;
    border-radius: 6px;
    background: var(--secondary-color, #666);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
.imgstorage_search_btn:hover {
    opacity: 0.9;
}

.imgstorage_category_buttons a.imgstorage_category_btn.is-active {
    background: var(--btn-accent-bg, #333);
    color: var(--btn-accent-text, #fff);
    border-color: var(--btn-accent-bg, #333);
}

.imgstorage_uploadimg_left {
    width: 30%;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.imgstorage_title_row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.imgstorage_title_row .imgstorage_category_select {
    flex-shrink: 0;
    width: 28%;
    min-width: 80px;
    height: 30px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
}

.imgstorage_title_row .imgstorage_input_title {
    flex: 1;
    min-width: 0;
}

.imgstorage_uploadimg_left .imgstorage_input_title,
.imgstorage_uploadimg_left .imgstorage_input_subtitle {
    height: 30px;
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.imgstorage_uploadimg_right {
    flex: 1;
    min-width: 120px;
    max-width: 200px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

/* 버튼 행이 우측 영역 가로 최대 길이 안에 오도록, 미리보기는 상단 정렬 */
.imgstorage_actions_row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    min-height: 30px;
    max-width: 100%;
}

.imgstorage_actions_row .imgstorage_btn_attach {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--btn-secondary-bg, #666);
    background: #fff;
    color: var(--btn-secondary-bg, #666);
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.imgstorage_actions_row .imgstorage_btn_attach:hover {
    background: var(--btn-secondary-bg, #666);
    color: var(--btn-secondary-text, #fff);
}

.imgstorage_secondary_row {
    display: none;
    align-items: center;
    gap: 6px;
    height: 30px;
    width: 100%;
}

.imgstorage_secondary_row.is-visible {
    display: flex;
}

/* URL/붙여넣기 입력 시: 입력창 1줄, 입력 완료/입력 취소 버튼은 다음 줄(올리기 버튼과 같은 줄에 맞춤) */
.imgstorage_secondary_row.imgstorage_reply_url.is-visible,
.imgstorage_secondary_row.imgstorage_reply_paste.is-visible {
    flex-wrap: wrap;
    height: auto;
    min-height: 30px;
}

.imgstorage_secondary_row.imgstorage_reply_url.is-visible input[type="text"],
.imgstorage_secondary_row.imgstorage_reply_paste.is-visible input[type="text"] {
    flex: 1 1 100%;
    min-width: 100%;
}

.imgstorage_secondary_row input[type="text"] {
    height: 30px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
}

.imgstorage_secondary_row .imgstorage_btn_cancel {
    height: 30px;
    padding: 0 10px;
    border: 1px solid #ccc;
    background: #fff;
    color: #666;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.imgstorage_secondary_row .imgstorage_btn_done {
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--btn-secondary-bg, #666);
    background: #fff;
    color: var(--btn-secondary-bg, #666);
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

/* 미리보기: 붙여넣기 버튼 옆, ×는 이미지 바깥 오른쪽 상단 */
.imgstorage_preview_wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.imgstorage_preview {
    width: 60px;
    height: 60px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: #f5f5f5;
}

.imgstorage_preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.imgstorage_preview_remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1px solid #ccc;
    background: #fff;
    color: #666;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    z-index: 1;
}

.imgstorage_preview_remove:hover {
    background: #f0f0f0;
    color: #333;
}

.imgstorage_submit_row {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

/* left 영역: 부제 아래, 민감한 콘텐츠 체크 + 올리기 버튼(올리기 버튼 바로 왼쪽에 체크박스) */
.imgstorage_submit_row--left {
    margin-top: 8px;
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

.imgstorage_sensitive_option {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
}

.imgstorage_wr_adult_check {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}

.imgstorage_sensitive_label {
    font-size: 13px;
    color: #333;
}

.imgstorage_submit_row .imgstorage_btn_submit {
    padding:6px 8px;
    border: none;
    border-radius: 4px;
    background: var(--btn-secondary-bg, #666);
    color: var(--btn-secondary-text, #fff);
    font-size: 12px;
    cursor: pointer;
}

.imgstorage_submit_row .imgstorage_btn_submit:hover {
    opacity: 0.9;
}

.imgstorage_submit_row .imgstorage_btn_submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* list area - 갤러리 크기는 list.skin.php에서 --imgstorage-gallery-width/height 로 주입 */
.imgstorage_list_area {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 16px;
    padding: 0 10px;
    max-width: 1400px;
    margin: 0 auto;
}

.imgstorage_list_item_wrap {
    position: relative;
    width: var(--imgstorage-gallery-width, 300px);
    flex-shrink: 0;
}

/* 수정/삭제 버튼 - 이미지 위쪽 */
.imgstorage_item_actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-bottom: 4px;
}
.imgstorage_btn_action {
    font-size: 10px;
    color: var(--secondary-color);
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 4px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.imgstorage_btn_action:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.imgstorage_item_badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    left: auto;
    z-index: 1;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: var(--btn-secondary-bg, #666);
    color: var(--btn-secondary-text, #fff);
    font-size: 10px;
    line-height: 18px;
    text-align: center;
}

.imgstorage_list_item {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--card-border-color);
    width: 100%;
}

.imgstorage_list_item .imgstorage_item_img_wrap {
    position: relative;
    width: 100%;
    height: var(--imgstorage-gallery-height, 300px);
    background: #f5f5f5;
    overflow: hidden;
}

.imgstorage_list_item .imgstorage_item_img_wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 민감한 콘텐츠 체크 시 list item 이미지 블러 */
.imgstorage_list_item .imgstorage_item_img_wrap--sensitive img {
    filter: blur(10px);
}

.imgstorage_list_item .imgstorage_item_explain {
    padding: 10px;
    background-color: var(--card-bg-color);
}

.imgstorage_list_item .imgstorage_item_explain .imgstorage_explain_title {
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.imgstorage_list_item .imgstorage_item_explain .imgstorage_explain_subtitle {
    font-size: 13px;
    color: var(--secondary-color);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    text-overflow: ellipsis;
}
.imgstorage_list_item .imgstorage_item_explain .imgstorage_explain_subtitle a.imgstorage_explain_subtitle_link {
    color: var(--secondary-color);
    text-decoration: underline;
}
.imgstorage_list_item .imgstorage_item_explain .imgstorage_explain_subtitle a.imgstorage_explain_subtitle_link:hover {
    opacity: 0.8;
}

.imgstorage_list_item .imgstorage_item_explain .imgstorage_explain_meta {
    font-size: 10px;
    color: var(--content-font-color);
}

.imgstorage_empty {
    padding: 40px;
    text-align: center;
    color: #999;
}

/* ========== imgstorage 수정 모달 ========== */
.imgstorage_edit_modal .imgstorage_edit_modal_box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.imgstorage_edit_modal_header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.imgstorage_edit_modal_title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.imgstorage_edit_modal_close {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: #666;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.imgstorage_edit_modal_close:hover {
    color: #333;
}

.imgstorage_edit_form {
    padding: 20px;
}

.imgstorage_edit_row {
    margin-bottom: 16px;
}

.imgstorage_edit_row:last-of-type {
    margin-bottom: 20px;
}

.imgstorage_edit_label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.imgstorage_edit_input,
.imgstorage_edit_select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.imgstorage_edit_input:focus,
.imgstorage_edit_select:focus {
    outline: none;
    border-color: var(--secondary-color, #666);
}

.imgstorage_edit_check_wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.imgstorage_edit_check {
    width: 18px;
    height: 18px;
}

.imgstorage_edit_actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.imgstorage_edit_btn_cancel,
.imgstorage_edit_btn_submit {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.imgstorage_edit_btn_cancel {
    background: #eee;
    color: #666;
}

.imgstorage_edit_btn_cancel:hover {
    background: #ddd;
}

.imgstorage_edit_btn_submit {
    background: var(--secondary-color, #666);
    color: #fff;
}

.imgstorage_edit_btn_submit:hover {
    opacity: 0.9;
}

.imgstorage_edit_btn_submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========== imgstorage 이미지 모달 ========== */
.imgstorage_modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.2s, opacity 0.2s;
}

.imgstorage_modal.imgstorage_modal--open {
    visibility: visible;
    opacity: 1;
}

.imgstorage_modal_backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.imgstorage_modal_wrap {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.imgstorage_modal_actions {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 10px;
}
.imgstorage_modal--no-download .imgstorage_modal_actions {
    justify-content: center;
}

/* 관리자 외 이미지 드래그 방지 */
.imgstorage_list[data-no-drag="1"] .imgstorage_item_img_wrap img,
.imgstorage_modal--no-drag .imgstorage_modal_img,
.imgstorage-no-drag img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

.imgstorage_modal_action_group {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.imgstorage_modal_btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
}

.imgstorage_modal_btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.imgstorage_modal_msg {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 6px;
    padding: 6px 10px;
    font-size: 11px;
    color: #fff;
    background: #333;
    border-radius: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.imgstorage_modal_msg.imgstorage_modal_msg--show {
    opacity: 1;
}

.imgstorage_modal_close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    border-radius: 4px;
    cursor: pointer;
}

.imgstorage_modal_close:hover {
    background: rgba(0, 0, 0, 0.7);
}

.imgstorage_modal_box {
    position: relative;
    box-sizing: border-box;
    padding: 10px;
    background: var(--container-bg-color, #fff);
    border: 1px solid var(--container-border-color, #eee);
    border-radius: var(--container-border-radius, 8px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.imgstorage_modal_img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    vertical-align: top;
}

/* ========== view.skin.php (모달/팝업 내부) ========== */
.imgstorage_view {
    max-width: 90%;
    margin: 0 auto;
    padding: 12px;
}

.imgstorage_view_buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.imgstorage_view_buttons a {
    padding: 8px 14px;
    border-radius: 4px;
    background: var(--btn-secondary-bg, #666);
    color: var(--btn-secondary-text, #fff);
    text-decoration: none;
    font-size: 14px;
}

.imgstorage_view_buttons a:hover {
    opacity: 0.9;
}

.imgstor_container {
    background: var(--container-bg-color, #fff);
    border: 1px solid var(--container-border-color, #eee);
    border-radius: var(--container-border-radius, 12px);
    padding: 16px;
    overflow: hidden;
}

.imgstor_container .imgstorage_view_buttons {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.imgstor_container--popup {
    margin: 0;
    max-width: 100%;
}

.imgstor_container_title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--header-font-color, #333);
}

.imgstor_container_subtitle {
    font-size: 0.95rem;
    margin: 0 0 16px 0;
    color: var(--content-font-color, #666);
}
.imgstor_container_subtitle a.imgstorage_explain_subtitle_link {
    color: var(--secondary-color);
    text-decoration: underline;
}
.imgstor_container_subtitle a.imgstorage_explain_subtitle_link:hover {
    opacity: 0.8;
}

.imgstor_container_img_wrap {
    max-width: 80vw;
    max-height: 80vh;
    margin: 0 auto;
    text-align: center;
}

.imgstor_container_img_wrap img {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}
