/* =========================================================
   GNUBOARD GALLERY WRITE
   갤러리 글쓰기 전용
========================================================= */

.gallery-write-wrap {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    color: #222;
    box-sizing: border-box;
}


/* =========================================================
   TITLE
========================================================= */

.gallery-write-title {
    margin-bottom: 25px;
}

.gallery-write-title h2 {
    margin: 0;

    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.8px;
}

.gallery-write-title p {
    margin: 8px 0 0;

    color: #888;
    font-size: 14px;
}


/* =========================================================
   FORM
========================================================= */

.gallery-write-form {
    border-top: 2px solid #222;
}


/* =========================================================
   ROW
========================================================= */

.gallery-write-row {
    display: flex;

    min-height: 58px;

    border-bottom: 1px solid #e8e8e8;

    box-sizing: border-box;
}


/* =========================================================
   LABEL
========================================================= */

.gallery-write-label {
    display: flex;
    align-items: center;

    width: 145px;
    flex-shrink: 0;

    padding: 15px 20px;

    background: #f8f9fb;

    color: #333;

    font-size: 14px;
    font-weight: 600;

    box-sizing: border-box;
}

.gallery-write-label.required::after {
    content: "*";

    margin-left: 4px;

    color: #e53935;
}


/* =========================================================
   FIELD
========================================================= */

.gallery-write-field {
    flex: 1;

    min-width: 0;

    padding: 9px 12px;

    box-sizing: border-box;
}


/* =========================================================
   INPUT
========================================================= */

.gallery-write-field input[type="text"],
.gallery-write-field input[type="password"],
.gallery-write-field input[type="email"],
.gallery-write-field select {
    width: 100%;
    height: 42px;

    padding: 0 13px;

    border: 1px solid #dfe3e8;
    border-radius: 5px;

    background: #fff;

    color: #333;

    font-size: 14px;

    outline: none;

    box-sizing: border-box;

    transition:
        border-color .2s,
        box-shadow .2s;
}

.gallery-write-field input:focus,
.gallery-write-field select:focus {
    border-color: #2867d8;

    box-shadow:
        0 0 0 3px rgba(40,103,216,.08);
}


/* 제목 */

.gallery-write-subject {
    font-size: 15px !important;
}


/* =========================================================
   SELECT
========================================================= */

.gallery-write-field select {
    max-width: 220px;

    cursor: pointer;
}


/* =========================================================
   CONTENT
========================================================= */

.gallery-write-content {
    padding: 12px;
}

.gallery-write-content textarea {
    display: block;

    width: 100%;
    min-height: 300px;

    padding: 15px;

    border: 1px solid #dfe3e8;
    border-radius: 5px;

    background: #fff;

    color: #333;

    font-size: 14px;
    line-height: 1.7;

    resize: vertical;

    outline: none;

    box-sizing: border-box;
}

.gallery-write-content textarea:focus {
    border-color: #2867d8;

    box-shadow:
        0 0 0 3px rgba(40,103,216,.08);
}


/* =========================================================
   IMAGE UPLOAD AREA
========================================================= */

.gallery-upload-area {
    width: 100%;
}


/* 안내 */

.gallery-upload-guide {
    margin-bottom: 12px;

    color: #888;

    font-size: 12px;
    line-height: 1.6;
}


/* =========================================================
   대표 이미지
========================================================= */

.gallery-cover-upload {
    display: flex;
    align-items: center;

    gap: 15px;

    margin-bottom: 15px;
}


/* 미리보기 */

.gallery-cover-preview {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 150px;
    height: 105px;

    flex-shrink: 0;

    overflow: hidden;

    border: 1px solid #ddd;
    border-radius: 6px;

    background: #f5f6f8;
}

.gallery-cover-preview img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
}

.gallery-cover-empty {
    color: #aaa;

    font-size: 12px;

    text-align: center;
}


/* 대표 이미지 입력 */

.gallery-cover-input {
    flex: 1;
}


/* =========================================================
   FILE INPUT
========================================================= */

.gallery-file {
    display: flex;
    align-items: center;

    gap: 10px;

    width: 100%;
}

.gallery-file input[type="file"] {
    width: 100%;
    height: 42px;

    padding: 8px;

    border: 1px solid #dfe3e8;
    border-radius: 5px;

    background: #fff;

    font-size: 13px;

    box-sizing: border-box;
}


/* =========================================================
   FILE LIST
========================================================= */

.gallery-file-list {
    margin-top: 10px;
}

.gallery-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 42px;

    padding: 8px 12px;

    border: 1px solid #eee;
    border-radius: 5px;

    background: #fafbfc;

    box-sizing: border-box;
}

.gallery-file-item + .gallery-file-item {
    margin-top: 5px;
}

.gallery-file-name {
    overflow: hidden;

    color: #555;

    font-size: 12px;

    white-space: nowrap;
    text-overflow: ellipsis;
}

.gallery-file-delete {
    flex-shrink: 0;

    margin-left: 10px;

    color: #999;

    font-size: 12px;

    text-decoration: none;
}

.gallery-file-delete:hover {
    color: #e53935;
}


/* =========================================================
   IMAGE UPLOAD GRID
========================================================= */

.gallery-upload-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 12px;

    margin-top: 15px;
}

.gallery-upload-card {
    position: relative;

    overflow: hidden;

    min-height: 150px;

    border: 1px dashed #d7dbe0;
    border-radius: 7px;

    background: #fafbfc;

    box-sizing: border-box;
}


/* 카드 내부 */

.gallery-upload-card label {
    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 150px;

    padding: 15px;

    cursor: pointer;

    box-sizing: border-box;
}


/* 아이콘 */

.gallery-upload-icon {
    margin-bottom: 8px;

    color: #2867d8;

    font-size: 25px;
}


/* 텍스트 */

.gallery-upload-text {
    color: #777;

    font-size: 12px;

    text-align: center;
}


/* 실제 input */

.gallery-upload-card input[type="file"] {
    position: absolute;

    width: 1px;
    height: 1px;

    opacity: 0;
}


/* =========================================================
   PREVIEW
========================================================= */

.gallery-preview {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 12px;

    margin-top: 15px;
}

.gallery-preview-item {
    position: relative;

    overflow: hidden;

    aspect-ratio: 4 / 3;

    border-radius: 6px;

    background: #f1f2f4;
}

.gallery-preview-item img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
}


/* 대표 표시 */

.gallery-preview-cover {
    position: absolute;

    top: 8px;
    left: 8px;

    padding: 4px 7px;

    border-radius: 3px;

    background: #2867d8;

    color: #fff;

    font-size: 10px;
}


/* 삭제 버튼 */

.gallery-preview-delete {
    position: absolute;

    top: 7px;
    right: 7px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 24px;
    height: 24px;

    border: 0;
    border-radius: 50%;

    background: rgba(0,0,0,.55);

    color: #fff;

    font-size: 12px;

    cursor: pointer;
}


/* =========================================================
   CHECKBOX
========================================================= */

.gallery-write-check {
    display: flex;
    align-items: center;

    gap: 7px;

    color: #555;

    font-size: 13px;

    cursor: pointer;
}

.gallery-write-check input {
    width: 16px;
    height: 16px;

    margin: 0;

    accent-color: #2867d8;
}


/* =========================================================
   HELP
========================================================= */

.gallery-write-help {
    margin-top: 7px;

    color: #999;

    font-size: 12px;
    line-height: 1.5;
}


/* =========================================================
   BUTTON
========================================================= */

.gallery-write-buttons {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    margin-top: 25px;
}

.gallery-write-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 110px;
    height: 46px;

    padding: 0 20px;

    border: 1px solid #dfe3e8;
    border-radius: 5px;

    background: #fff;

    color: #555;

    font-size: 14px;
    font-weight: 500;

    text-decoration: none;

    cursor: pointer;

    box-sizing: border-box;
}

.gallery-write-btn:hover {
    background: #f7f8fa;
}

.gallery-write-btn.primary {
    border-color: #2867d8;

    background: #2867d8;

    color: #fff;
}

.gallery-write-btn.primary:hover {
    border-color: #1e55b8;

    background: #1e55b8;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 768px) {

    .gallery-write-title h2 {
        font-size: 22px;
    }


    .gallery-write-row {
        display: block;

        min-height: auto;
    }


    .gallery-write-label {
        width: 100%;
        min-height: 44px;

        padding: 12px 13px;

        background: #f7f8fa;

        font-size: 13px;
    }


    .gallery-write-field {
        width: 100%;

        padding: 9px 0;
    }


    .gallery-write-field input[type="text"],
    .gallery-write-field input[type="password"],
    .gallery-write-field input[type="email"],
    .gallery-write-field select {
        height: 44px;
    }


    .gallery-write-field select {
        max-width: 100%;
    }


    .gallery-write-content {
        padding: 9px 0;
    }


    .gallery-write-content textarea {
        min-height: 260px;
    }


    /* 대표 이미지 */

    .gallery-cover-upload {
        display: block;
    }

    .gallery-cover-preview {
        width: 100%;
        height: 190px;

        margin-bottom: 10px;
    }


    /* 업로드 GRID */

    .gallery-upload-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 8px;
    }

    .gallery-upload-card {
        min-height: 120px;
    }

    .gallery-upload-card label {
        min-height: 120px;
    }


    /* PREVIEW */

    .gallery-preview {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 8px;
    }


    /* BUTTON */

    .gallery-write-buttons {
        gap: 6px;
    }

    .gallery-write-btn {
        flex: 1;

        min-width: 0;
    }

}


/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 480px) {

    .gallery-write-title {
        margin-bottom: 18px;
    }

    .gallery-write-title h2 {
        font-size: 20px;
    }

    .gallery-write-title p {
        font-size: 12px;
    }


    .gallery-cover-preview {
        height: 160px;
    }


    .gallery-upload-grid {
        grid-template-columns: 1fr 1fr;
    }


    .gallery-preview {
        grid-template-columns: 1fr 1fr;
    }


    .gallery-write-btn {
        height: 44px;

        padding: 0 10px;

        font-size: 13px;
    }

}