/* ============================================================
   공통 모달 스타일 (메뉴 모달, 업로드 모달)
   ============================================================ */

/* ============ 메뉴 모달 스타일 ============ */
.menu-modal-content {
    max-width: 1100px;
    max-height: 90vh;
}

.menu-section {
    margin-bottom: 30px;
}

.menu-section:last-child {
    margin-bottom: 0;
}

.menu-section-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid #ff6c0f;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 25px;
}

.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    padding: 15px 10px;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background-color: #f8f9fa;
}

.menu-item:hover {
    background-color: #fff5ed;
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 8px 20px rgba(255, 108, 15, 0.25);
}

.menu-item:active {
    transform: translateY(-4px) scale(0.98);
}

.menu-icon {
    width: 85px;
    height: 55px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.menu-item:hover .menu-icon {
    transform: scale(1.1) rotate(5deg);
}

.menu-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.menu-icon-box {
    width: 80px;
    height: 55px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    color: #656565;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.menu-item:hover .menu-icon-box {
    border-color: #ff6c0f;
    color: #ff6c0f;
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 4px 12px rgba(255, 108, 15, 0.2);
}

.menu-icon-box svg {
    width: 30px;
    height: 30px;
    transition: transform 0.3s ease;
}

.menu-item:hover .menu-icon-box svg {
    transform: scale(1.15);
}

.menu-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin-bottom: 3px;
    transition: color 0.3s ease;
}

.menu-item:hover .menu-label {
    color: #ff6c0f;
}

.menu-age {
    font-size: 12px;
    color: #888;
    text-align: center;
}

.menu-divider {
    height: 2px;
    background: linear-gradient(to right, transparent, #e0e0e0 20%, #e0e0e0 80%, transparent);
    margin: 25px 0;
}

/* 메뉴 모달 - 로딩/빈 상태 */
.menu-loading,
.menu-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-size: 14px;
}

/* 메뉴 모달 - 썸네일 없을 때 placeholder */
.menu-icon-placeholder {
    width: 85px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ff6c0f, #ff8c3a);
    border-radius: 10px;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
}

/* ============ 업로드 모달 스타일 ============ */
.upload-modal-content {
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    position: relative;
}

.upload-modal-loading {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    z-index: 5;
    color: #333;
    font-weight: 600;
}

.upload-modal-loading-spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid #ffe0cc;
    border-top-color: #ff6c0f;
    animation: uploadModalSpin 0.8s linear infinite;
}

@keyframes uploadModalSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.upload-modal-content.loading .upload-modal-loading {
    display: flex;
}

.upload-modal-content.loading .upload-modal-header,
.upload-modal-content.loading .upload-modal-body,
.upload-modal-content.loading .upload-modal-footer {
    pointer-events: none;
    filter: blur(1px);
    opacity: 0.5;
}

.upload-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 30px 40px 20px;
    padding-right: 35px;
    margin-right: 10px;
}

/* 모달 스크롤바 스타일 */
.upload-modal-body::-webkit-scrollbar {
    width: 10px;
}

.upload-modal-body::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 10px;
    margin: 8px 0;
}

.upload-modal-body::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 10px;
    border: 2px solid #f5f5f5;
    transition: background 0.3s ease;
}

.upload-modal-body::-webkit-scrollbar-thumb:hover {
    background: #b0b0b0;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.upload-form-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.upload-form-label {
    font-size: 15px;
    font-weight: 700;
    color: #333;
}

/* 라디오 버튼 그룹 */
.upload-radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.upload-radio-group-multi {
    gap: 12px;
}

.upload-radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 18px;
    background-color: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.upload-radio-item:hover {
    background-color: #fff5ed;
    border-color: #ff6c0f;
}

.upload-radio-item input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #ff6c0f;
}

.upload-radio-item input[type="radio"]:checked+.upload-radio-label {
    color: #ff6c0f;
    font-weight: 600;
}

.upload-radio-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* 셀렉트 박스 */
.upload-select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
    color: #333;
    background-color: #fafafa;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23656565' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 45px;
}

.upload-select:focus {
    outline: none;
    border-color: #ff6c0f;
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(255, 108, 15, 0.1);
}

/* 입력 필드 */
.upload-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
    color: #333;
    background-color: #fafafa;
    transition: all 0.3s ease;
}

.upload-input:focus {
    outline: none;
    border-color: #ff6c0f;
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(255, 108, 15, 0.1);
}

.upload-input::placeholder {
    color: #aaa;
}

/* 텍스트에리어 */
.upload-textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
    color: #333;
    background-color: #fafafa;
    resize: vertical;
    font-family: inherit;
    transition: all 0.3s ease;
    min-height: 120px;
}

.upload-textarea:focus {
    outline: none;
    border-color: #ff6c0f;
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(255, 108, 15, 0.1);
}

.upload-textarea::placeholder {
    color: #aaa;
}

/* 파일 업로드 영역 */
.upload-file-area {
    display: flex;
    gap: 16px;
    align-items: center;
}

.upload-file-box {
    width: 70px;
    height: 70px;
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fafafa;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.upload-file-box:hover {
    border-color: #ff6c0f;
    background-color: #fff5ed;
    transform: scale(1.05);
}

.upload-file-box svg {
    color: #656565;
    transition: all 0.3s ease;
}

.upload-file-box:hover svg {
    color: #ff6c0f;
    transform: rotate(90deg);
}

.upload-file-info {
    font-size: 12px;
    color: #656565;
    margin: 4px 0 0 0;
}

.upload-file-info:first-of-type {
    margin-top: 12px;
}

/* 파일 placeholder (선택 전 상태) */
.upload-file-placeholder {
    width: 100%;
    min-height: 120px;
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background-color: #fafafa;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 20px;
}

.upload-file-placeholder:hover {
    border-color: #ff6c0f;
    background-color: #fff5ed;
    transform: scale(1.01);
}

.upload-file-placeholder svg {
    color: #656565;
    transition: all 0.3s ease;
}

.upload-file-placeholder:hover svg {
    color: #ff6c0f;
    transform: scale(1.1);
}

.upload-file-placeholder span {
    font-size: 14px;
    color: #888;
    font-weight: 500;
}

.upload-file-placeholder:hover span {
    color: #ff6c0f;
}

/* 파일 아이템 (선택 후 상태) */
.upload-file-item {
    position: relative;
    width: 100%;
    min-height: 120px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: #fafafa;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-file-item:hover {
    border-color: #ff6c0f;
    background-color: #fff5ed;
}

.upload-file-item-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    max-width: 100%;
}

.upload-file-item-icon {
    font-size: 32px;
}

.upload-file-item-icon img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.upload-file-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-file-item-size {
    font-size: 12px;
    color: #888;
}

/* 삭제 버튼 - 오른쪽 위 */
.upload-file-item-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 6px 12px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #656565;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.upload-file-item-delete:hover {
    background-color: #ff4444;
    border-color: #ff4444;
    color: #fff;
}

/* 썸네일 파일 아이템 - 이미지 미리보기 */
.upload-file-item-thumbnail .upload-file-item-icon img {
    width: 100px;
    height: 100px;
}

/* 비디오/썸네일 리스트 컨테이너 */
.upload-video-list,
.upload-thumbnail-list {
    width: 100%;
}

/* 버튼 영역 - 하단 고정 */
.upload-modal-footer {
    flex-shrink: 0;
    padding: 20px 40px;
    background-color: #ffffff;
    border-top: 2px solid #f0f0f0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

.upload-form-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-upload-submit {
    flex: 1;
    max-width: 250px;
    padding: 14px 32px;
    background: linear-gradient(135deg, #ff6c0f, #ff8c3a);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(255, 108, 15, 0.3);
}

.btn-upload-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 108, 15, 0.4);
}

.btn-upload-submit:active {
    transform: translateY(0);
}

.btn-upload-cancel {
    flex: 1;
    max-width: 250px;
    padding: 14px 32px;
    background-color: #f5f5f5;
    color: #656565;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-upload-cancel:hover {
    background-color: #e0e0e0;
    border-color: #d0d0d0;
    transform: translateY(-1px);
}

.btn-upload-cancel:active {
    transform: translateY(0);
}

/* ============ 모달 토글 체크박스 ============ */
.modal-toggle {
    display: none;
}

/* 메뉴 모달 기본 숨김 */
.menu-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* 메뉴 토글 체크 시 모달 표시 */
#menu-toggle:checked~.menu-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
}

/* 메뉴 모달 콘텐츠 애니메이션 */
.menu-modal .menu-modal-content {
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#menu-toggle:checked~.menu-modal .menu-modal-content {
    transform: scale(1);
}

/* 업로드 모달 기본 숨김 */
.upload-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* 업로드 토글 체크 시 모달 표시 */
#upload-toggle:checked~.upload-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
}

/* 업로드 모달 콘텐츠 애니메이션 */
.upload-modal .upload-modal-content {
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#upload-toggle:checked~.upload-modal .upload-modal-content {
    transform: scale(1);
}

/* 업로드 모달이 열리면 다른 모달 숨기기 */
#upload-toggle:checked~.menu-modal {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

#upload-toggle:checked~.chat-floating-panel {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* 채팅이 열리면 메뉴 모달 숨기기 */
#chat-toggle:checked~.menu-modal {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* ============ 반응형 디자인 ============ */
@media (max-width: 1200px) {
    .menu-modal-content {
        max-width: 950px;
        max-height: 88vh;
    }

    .menu-grid {
        gap: 22px;
    }

    .menu-icon {
        width: 78px;
        height: 52px;
    }

    .menu-icon-box {
        width: 74px;
        height: 52px;
    }

    .menu-icon-box svg {
        width: 28px;
        height: 28px;
    }

    .menu-section-title {
        font-size: 19px;
    }

    .menu-label {
        font-size: 13.5px;
    }
}

@media (max-width: 1024px) {
    .menu-modal-content {
        max-width: 850px;
        max-height: 90vh;
    }

    .menu-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 20px;
    }

    .menu-icon {
        width: 72px;
        height: 50px;
    }

    .menu-icon-box {
        width: 68px;
        height: 50px;
    }

    .menu-icon-box svg {
        width: 26px;
        height: 26px;
    }

    .menu-section-title {
        font-size: 18px;
    }

    .menu-label {
        font-size: 13px;
    }

    .upload-modal-content {
        max-width: 850px;
    }

    .upload-modal-body {
        padding: 28px 35px 20px;
        padding-right: 30px;
        margin-right: 8px;
    }

    .upload-modal-footer {
        padding: 18px 35px;
    }

    .upload-form {
        gap: 22px;
    }
}

@media (max-width: 768px) {
    .menu-modal-content {
        max-width: 98%;
    }

    .menu-section-title {
        font-size: 17px;
        margin-bottom: 18px;
    }

    .menu-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }

    .menu-item {
        padding: 12px 8px;
    }

    .menu-icon {
        width: 68px;
        height: 48px;
        margin-bottom: 10px;
    }

    .menu-icon-box {
        width: 64px;
        height: 48px;
        margin-bottom: 10px;
    }

    .menu-icon-box svg {
        width: 24px;
        height: 24px;
    }

    .menu-label {
        font-size: 12.5px;
    }

    .menu-age {
        font-size: 11px;
    }

    .menu-divider {
        margin: 22px 0;
    }

    .upload-modal-content {
        max-width: 98%;
    }

    .upload-modal-body {
        padding: 25px 30px 18px;
        padding-right: 28px;
        margin-right: 5px;
    }

    .upload-modal-footer {
        padding: 16px 30px;
    }

    .upload-form {
        gap: 20px;
    }

    .upload-form-label {
        font-size: 14px;
    }

    .upload-radio-group {
        gap: 12px;
    }

    .upload-radio-group-multi {
        gap: 10px;
    }

    .upload-radio-item {
        padding: 9px 16px;
    }

    .upload-radio-label {
        font-size: 13px;
    }

    .upload-select,
    .upload-input {
        padding: 12px 16px;
        font-size: 13px;
    }

    .upload-select {
        padding-right: 42px;
        background-position: right 16px center;
    }

    .upload-textarea {
        padding: 12px 16px;
        font-size: 13px;
        min-height: 100px;
    }

    .upload-file-box {
        width: 65px;
        height: 65px;
    }

    .upload-file-box svg {
        width: 36px;
        height: 36px;
    }

    .upload-file-info {
        font-size: 11px;
    }

    .btn-upload-submit,
    .btn-upload-cancel {
        padding: 13px 28px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .menu-modal-content {
        max-height: 92vh;
    }

    .menu-section-title {
        font-size: 16px;
        margin-bottom: 16px;
    }

    .menu-grid {
        gap: 15px;
    }

    .menu-item {
        padding: 10px 6px;
    }

    .menu-icon {
        width: 64px;
        height: 45px;
        margin-bottom: 8px;
    }

    .menu-icon-box {
        width: 60px;
        height: 45px;
        margin-bottom: 8px;
    }

    .menu-icon-box svg {
        width: 22px;
        height: 22px;
    }

    .menu-label {
        font-size: 12px;
    }

    .menu-age {
        font-size: 10.5px;
    }

    .menu-divider {
        margin: 20px 0;
    }

    .upload-modal-body {
        padding: 20px 25px 16px;
        padding-right: 23px;
        margin-right: 4px;
    }

    .upload-modal-footer {
        padding: 14px 25px;
    }

    .upload-form {
        gap: 18px;
    }

    .upload-form-label {
        font-size: 13px;
    }

    .upload-radio-group {
        gap: 10px;
    }

    .upload-radio-item {
        padding: 8px 14px;
        flex: 1;
        min-width: calc(50% - 5px);
        justify-content: center;
    }

    .upload-radio-item input[type="radio"] {
        width: 16px;
        height: 16px;
    }

    .upload-radio-label {
        font-size: 12px;
    }

    .upload-select,
    .upload-input {
        padding: 11px 15px;
        font-size: 13px;
    }

    .upload-select {
        padding-right: 40px;
        background-position: right 15px center;
    }

    .upload-textarea {
        padding: 11px 15px;
        font-size: 13px;
        min-height: 90px;
    }

    .upload-file-box {
        width: 60px;
        height: 60px;
    }

    .upload-file-box svg {
        width: 32px;
        height: 32px;
    }

    .upload-file-info {
        font-size: 10px;
    }

    .upload-form-actions {
        flex-direction: column;
        gap: 10px;
    }

    .btn-upload-submit,
    .btn-upload-cancel {
        max-width: 100%;
        padding: 12px 24px;
        font-size: 14px;
    }
}

@media (max-width: 360px) {
    .menu-modal-content {
        max-height: 95vh;
    }

    .menu-icon {
        width: 56px;
        height: 42px;
    }

    .menu-icon-box {
        width: 54px;
        height: 42px;
    }

    .menu-icon-box svg {
        width: 20px;
        height: 20px;
    }

    .menu-label {
        font-size: 11px;
    }

    .menu-age {
        font-size: 10px;
    }

    .upload-modal-body {
        padding: 18px 20px 14px;
        padding-right: 18px;
        margin-right: 3px;
    }

    .upload-modal-footer {
        padding: 12px 20px;
    }

    .upload-form {
        gap: 16px;
    }

    .upload-radio-item {
        padding: 7px 12px;
    }

    .upload-file-box {
        width: 55px;
        height: 55px;
    }

    .upload-file-box svg {
        width: 28px;
        height: 28px;
    }
}