﻿/* =============================================
   FreeMode Design System - Modal Styles
   ============================================= */

/* ===== Modal Styles (Unified) ===== */
.modal-overlay {
    backdrop-filter: blur(1px);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 모달 호출 시 배경을 ref-ink 기준 60% 딤드로 처리한다. */
    background: color-mix(in srgb, var(--ref-ink) 60%, transparent);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: var(--k-z-overlay);
}

/* 모달 위에 모달을 띄울 때 배경 없는 오버레이 */
.modal-overlay.no-backdrop {
    background: color-mix(in srgb, var(--ref-ink) 60%, transparent);
    backdrop-filter: blur(1px);
    z-index: var(--k-z-modal);
}

/* Base Modal Container - 통일된 기본 스타일 */
.modal-container {
    /* 기본 모달의 내부 가로 여백 값을 공통 변수로 관리한다. */
    --modal-inline-padding: 24px;
    background: var(--k-bg-white);
    border: none !important;
    border-radius: var(--k-radius-md);
    padding: 24px 0;
    max-width: 530px;
    width: 90%;
    position: relative;
    box-shadow: var(--k-shadow-modal);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

/* 개인정보 약관 모달 전용 클래스 - 중앙 정렬 보장 */
.privacy-modal-content {
    background: var(--k-bg-white);
    border-radius: var(--k-radius-sm);
    padding: 16px 24px;
    max-width: 700px;
    width: 90%;
    position: relative;
    box-shadow: var(--k-shadow-box);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    margin: 0;
}

/* Modal Size Variants */
.modal-container.modal-small {
    max-width: 400px;
}

.modal-container.modal-medium {
    max-width: 600px;
}

.modal-container.modal-large {
    max-width: 800px;
}

.modal-container.modal-xlarge {
    max-width: 1000px;
}

/* 마이페이지 모달 전용 스타일 - 가운데 정렬 및 흰색 배경 */
#myPageModal.modal-overlay {
    justify-content: center;
    align-items: center;
}

/* 고객 등록 모달 전용 스타일 - 가운데 정렬 및 흰색 배경 */
#customerModal.modal-overlay {
    justify-content: center;
    align-items: center;
}

/* Modal Fullscreen Mobile - 모바일에서 전체화면 모달 */
.modal-container.modal-fullscreen-mobile {
    /* 데스크탑에서는 기본 스타일 유지 */
}

/* Modal Container Tab - 탭이 있는 모달용 (padding 있음) */

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Modal Header */
.modal-header {
    padding: 0;
    padding-bottom: 16px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header.no-border {
    border-bottom: none;
}

/* 컨테이너 내부의 헤더/본문/푸터 가로 여백을 변수 기반으로 통일한다. */
.modal-container > .modal-header,
.modal-container > .modal-body,
.modal-container > .modal-footer {
    padding-left: var(--modal-inline-padding);
    padding-right: var(--modal-inline-padding);
}

/* Modal Title */
.modal-title {
    font-size: 20px;
    font-weight: 600;
    font-family: var(--k-font-primary);
    color: var(--ref-ink);
    margin: 0;
}

/* Modal Close Button */
.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--ref-gray-700);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.modal-close-btn:hover {
    color: var(--ref-ink);
    background-color: var(--k-bg-gray-light);
}

/* Modal Body */
.modal-body {
    padding: 0;
    overflow-y: auto;
    scrollbar-gutter: auto;
    flex: 1;
    min-height: 0;
    margin-right: 0;
    padding: 0 24px;
}

/* 모달 본문 스크롤바를 컨테이너 우측 끝에 정렬한다. */
.modal-container > .modal-body {
    margin-right: 0;
    padding-right: var(--modal-inline-padding);
}

.modal-body.no-padding {
    padding: 0;
}

/* no-padding 본문은 컨테이너 가로 여백을 적용하지 않는다. */
.modal-container > .modal-body.no-padding {
    padding-left: 0;
    padding-right: 0;
}

/* Modal Footer */
.modal-footer {
    padding: 0;
    padding-top: 24px;
    margin-top: 0px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.modal-footer.space-between {
    justify-content: space-between;
    padding: 0 24px;
}

.modal-footer.center {
    justify-content: center;
    gap: 8px;
}

.modal-footer.no-border {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

/* Form Groups in Modals */
.form-group {
    margin-bottom: 19px;
}

.form-label {
    display: block;
    margin-bottom: var(--k-space-form-label);
    font-weight: 600;
    font-size: 14px;
    color: var(--ref-ink);
}

/* Modal 내부의 모든 input과 textarea 폰트 사이즈 */
.modal-body input[type="text"],
.modal-body input[type="email"],
.modal-body input[type="password"],
.modal-body input[type="number"],
.modal-body input[type="date"],
.modal-body input[type="time"],
.modal-body input[type="tel"],
.modal-body input[type="url"],
.modal-body input[type="search"],
.modal-body textarea,
.modal-overlay input[type="text"],
.modal-overlay input[type="email"],
.modal-overlay input[type="password"],
.modal-overlay input[type="number"],
.modal-overlay input[type="date"],
.modal-overlay input[type="time"],
.modal-overlay input[type="tel"],
.modal-overlay input[type="url"],
.modal-overlay input[type="search"],
.modal-overlay textarea {
    font-size: 14px !important;
}

/* Modal Footer Sections */

/* 모바일에서는 기본 모달 컨테이너의 상하 패딩을 축소해 화면 활용도를 높인다. */
@media (max-width: 1023px) {
    .modal-container {
        padding: 12px 0;
    }
}
