@charset "utf-8";

/*
 * dropzone.attach.css
 * js/dropzone.attach.js が生成する添付ファイル用ドロップゾーン。
 * 配色はテーマの color.css が定義する CSS 変数に追随する。
 */

/* 元スキンのファイル欄・ラベルを隠す（input 自体は送信のため DOM に残す） */
.g5dz-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ---------------- zone ---------------- */

.g5dz {
    position: relative;
    display: block;
    width: 100%;
    margin: 0 0 12px;
    padding: 20px 16px;
    border: 2px dashed var(--border-input, #b6bcc4);
    border-radius: 10px;
    background: var(--bg-box-in, #eceef1);
    color: var(--body-color, #333);
    text-align: center;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
    box-sizing: border-box;
}

/* クリック用のヘルパー input。ゾーン全体を覆う透明な当たり判定。 */
.g5dz__picker {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.g5dz:hover,
.g5dz:focus-within {
    border-color: var(--sub-bg, #286ed3);
    background: var(--bg-input, #fff);
}

.g5dz:focus-within {
    box-shadow: 0 0 0 3px rgba(40, 110, 211, .18);
}

.g5dz.is-dragover {
    border-style: solid;
    border-color: var(--sub-bg, #286ed3);
    background: var(--bg-input, #fff);
    box-shadow: 0 0 0 4px rgba(40, 110, 211, .14);
}

/* ---------------- 案内文 ---------------- */

.g5dz__prompt {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}

.g5dz__title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-15, .9375rem);
    font-weight: 600;
    line-height: 1.4;
}

.g5dz__title svg {
    flex: 0 0 auto;
    transition: transform .15s ease;
}

.g5dz.is-dragover .g5dz__title svg {
    transform: translateY(-3px);
}

.g5dz__hint {
    font-size: var(--font-size-12, .75rem);
    line-height: 1.4;
    opacity: .6;
}

/* ---------------- 選択済みファイル一覧 ---------------- */

.g5dz__list {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    text-align: left;
}

.g5dz.has-files .g5dz__list {
    margin-top: 14px;
}

.g5dz__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    border: 1px solid var(--border-input, #d3d7dd);
    border-radius: 8px;
    background: var(--bg-input, #fff);
    min-width: 0;
}

.g5dz__thumb {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    overflow: hidden;
    border-radius: 6px;
    background: var(--bg-box-in, #eceef1);
    color: var(--body-color, #333);
}

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

.g5dz__body {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1 1 auto;
    min-width: 0;
}

.g5dz__meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

/* 添付説明欄（元の bf_content[] と同期する代理入力） */
.g5dz__desc {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 5px 8px;
    border: 1px solid var(--border-input, #d3d7dd);
    border-radius: 6px;
    background: var(--bg-input, #fff);
    color: var(--body-color, #333);
    font-size: var(--font-size-12, .75rem);
    line-height: 1.4;
    box-sizing: border-box;
}

.g5dz__desc:focus {
    outline: none;
    border-color: var(--sub-bg, #286ed3);
}

.g5dz__name {
    font-size: var(--font-size-13, .8125rem);
    font-weight: 600;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.g5dz__size {
    flex: 0 0 auto;
    font-size: var(--font-size-11, .6875rem);
    line-height: 1.4;
    opacity: .6;
}

.g5dz__remove {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--border-input, #d3d7dd);
    border-radius: 50%;
    background: transparent;
    color: var(--body-color, #333);
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.g5dz__remove:hover,
.g5dz__remove:focus-visible {
    border-color: #dc3545;
    background: #dc3545;
    color: #fff;
}

/* ---------------- エラー ---------------- */

.g5dz__error {
    position: relative;
    z-index: 2;
    display: none;
    margin: 10px 0 0;
    font-size: var(--font-size-12, .75rem);
    line-height: 1.4;
    color: #dc3545;
}

.g5dz.has-error {
    border-color: #dc3545;
}

.g5dz.has-error .g5dz__error {
    display: block;
}

/* ---------------- フォーム全体へのドラッグ ---------------- */

.g5dz-form-dragover .g5dz {
    border-color: var(--sub-bg, #286ed3);
}

/* ---------------- 狭い画面 ---------------- */

@media (max-width: 480px) {
    .g5dz {
        padding: 16px 12px;
    }

    .g5dz__title {
        gap: 6px;
        font-size: var(--font-size-13, .8125rem);
    }

    .g5dz__hint {
        font-size: var(--font-size-11, .6875rem);
    }

    .g5dz__item {
        gap: 8px;
    }

    .g5dz__meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 1px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .g5dz,
    .g5dz__title svg,
    .g5dz__remove {
        transition: none;
    }
}
