/* ===== Base Modal Override ===== */
/* 사이드바(240px) 영역을 제외한 컨텐츠 영역 기준으로 중앙 정렬 */
@media (min-width: 769px) {
    .modal {
        padding-left: 240px;
    }
}

.modal-azito .modal-content {
    border-radius: 12px;
    border: none;
}

.modal-azito .modal-body {
    padding: 32px;
    position: relative;
}

.modal-azito .modal-body > .btn-close {
    position: absolute;
    top: 20px;
    right: 20px;
}

.modal-title-center {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
}

.modal-azito.modal-genba-check .modal-body {
    padding-top: 0;
}

.modal-azito.modal-genba-check .open-modal-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
    /* modal-body에서 뺀 상단 패딩(32px)을 헤더가 차지해 모달 최상단까지 배경을 채운다 */
    padding: 32px 0 16px;
    background: var(--bg-card, #fff);
}

.modal-azito.modal-genba-check .open-modal-header .modal-title-center {
    flex: 1;
    margin: 0;
}

.modal-azito.modal-genba-check .open-modal-header .btn-close,
.modal-azito.modal-genba-check .open-modal-header .open-modal-header-spacer {
    flex-shrink: 0;
    width: 0.8em;
    height: 0.8em;
}

.modal-azito.modal-genba-check .open-modal-header .btn-close {
    margin: 0;
    padding: 0;
}

/* ===== Modal Preview ===== */
.modal-preview-images {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.modal-preview-image {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
    background: var(--neutral-5);
}

.modal-preview-info {
    font-size: 14px;
    line-height: 1.8;
}

.modal-preview-description {
    color: var(--text-secondary);
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Open Sale Modal ===== */
.open-modal-section {
    background: var(--bg-muted);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 16px;
}

.open-modal-section-preview {
    background: transparent;
    padding: 0;
}

.open-modal-section-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}

.open-modal-section .modal-preview {
    margin-bottom: 0;
    background: transparent;
    border: none;
    padding: 0;
}

.open-modal-section .modal-preview-info {
    color: #445062;
}

.open-modal-badge {
    display: inline-block;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 500;
    background: var(--badge-default-bg);
    color: var(--neutral-0);
    border-radius: 3px;
    margin-right: 2px;
    line-height: 1.4;
}

.open-modal-ticket-info {
    font-size: 13px;
    line-height: 2.2;
    color: var(--text-primary);
}

.open-modal-terms {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.open-modal-terms label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.open-modal-terms input[type="checkbox"] {
    display: none;
}

.open-modal-terms .check-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.open-modal-terms .terms-link {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--neutral-0);
    padding: 2px 8px;
    border-radius: 4px;
    text-decoration: none;
}

.open-modal-submit {
    display: block;
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    color: var(--neutral-0);
    background: var(--text-primary);
    border: none;
    border-radius: 12px;
    margin-top: 8px;
    cursor: pointer;
}

.open-modal-submit:hover {
    background: var(--btn-dark-hover);
}

.modal-info-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.modal-terms label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.modal-terms input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.modal-terms .terms-link {
    color: var(--primary);
    font-size: 13px;
}

@media (max-width: 768px) {
    .modal-preview-images {
        flex-direction: column;
    }

    .modal-preview-image {
        flex: 0 1 auto;
    }

    .modal-info-row {
        flex-direction: column;
        gap: 4px;
    }

    .open-modal-ticket-info {
        line-height: 1.6;
    }
}

/* ===== Edit Modal ===== */
.edit-modal .modal-dialog {
    max-width: 640px;
}

.edit-modal .modal-content {
    border-radius: 20px;
    border: none;
    box-shadow: var(--shadow-modal);
}

.edit-modal .modal-header {
    padding: 28px 32px 0;
    border-bottom: none;
    align-items: center;
    gap: 8px;
}

.edit-modal .modal-header .modal-title {
    flex: 1;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin: 0;
}

.edit-modal .modal-header .btn-close,
.edit-modal .modal-header .edit-modal-header-spacer {
    flex-shrink: 0;
    width: 0.8em;
    height: 0.8em;
}

.edit-modal .modal-header .btn-close {
    margin: 0;
    padding: 0;
}

.edit-modal .modal-body {
    padding: 24px 32px 32px;
}

.edit-modal-profile {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
    background: var(--neutral-5);
    box-shadow: var(--shadow-profile);
}

.edit-modal-profile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.edit-modal-profile img[src=""],
.edit-modal-profile img:not([src]) {
    content: url('/images/icon-avatar-lg.png');
}

.edit-modal .edit-form-section {
    border: 1px solid var(--sidebar-text);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.edit-modal .edit-form-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.edit-modal .edit-form-section .edit-form-group:last-child,
.edit-modal .edit-form-section .edit-form-row:last-child {
    margin-bottom: 0;
}

.edit-modal .edit-form-group {
    margin-bottom: 16px;
}

.edit-modal .edit-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.edit-modal .edit-form-group input,
.edit-modal .edit-form-group select,
.edit-modal .edit-form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--sidebar-text);
    border-radius: 10px;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
    background-color: #fff;
}

.edit-modal .edit-form-group .edit-form-value {
    margin: 0;
    padding: 12px 14px;
    font-size: 14px;
    color: var(--text-primary);
}

.edit-modal .edit-form-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.edit-modal .edit-form-group input:focus,
.edit-modal .edit-form-group select:focus,
.edit-modal .edit-form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.edit-modal .edit-form-row {
    display: flex;
    gap: 12px;
}

.edit-modal .edit-form-row .edit-form-group {
    flex: 1;
    min-width: 0;
}

.edit-modal .edit-modal-footer {
    display: flex;
    gap: 8px;
    padding-top: 12px;
}

.edit-modal .btn-modal-cancel {
    display: none;
    background: var(--neutral-0);
    font-size: 14px;
    cursor: pointer;
}

.edit-modal .btn-modal-save {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    background: var(--btn-dark);
    color: var(--neutral-0);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.edit-modal .btn-modal-save:hover {
    opacity: 0.9;
}

@media (max-width: 768px) {
    /* 상단 .mobile-nav(48px, z-index 1100)에 가려지지 않도록 56px 아래에서 시작 */
    .modal-dialog {
        margin: 56px auto 5vh;
        max-width: calc(100% - 32px);
    }

    .modal-dialog-centered {
        min-height: auto;
    }

    /* 위 56px + 아래 5vh 빼고 남는 영역만큼 모달 박스 높이, body만 내부 스크롤 */
    .modal-dialog-scrollable {
        height: calc(95vh - 56px);
    }

    .modal-content {
        max-height: 100%;
        overflow: hidden;
    }

    /* 상단바 회피 margin(72px)~하단(8px) 제외 영역을 차지해 modal-dialog-centered로 수직 중앙 정렬,
       콘텐츠가 길면 .edit-modal .modal-content의 max-height에서 제한 + modal-body 내부 스크롤 */
    .edit-modal .modal-dialog {
        margin: 72px 8px 8px;
        max-width: calc(100% - 16px);
        min-height: calc(100vh - 80px);
    }

    .edit-modal .modal-content {
        max-height: calc(100vh - 88px);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .edit-modal .modal-header {
        padding: 20px 20px 0;
        flex-shrink: 0;
    }

    .edit-modal .modal-body {
        padding: 20px;
        overflow-y: auto;
        flex: 1 1 auto;
        min-height: 0;
    }

    .edit-modal .edit-form-row {
        flex-direction: column;
        gap: 0;
    }

    .modal-azito .modal-body {
        padding: 48px 20px 20px;
    }

    .modal-azito .modal-body > .btn-close {
        position: sticky;
        top: 12px;
        margin-left: auto;
        display: block;
        background-color: var(--bg-card, #fff);
        border-radius: 50%;
        z-index: 10;
    }

    /* 상단바(56px) 아래 ~ 하단 .mobile-cta-actions(~90px) 위 영역에서 모달을 수직 중앙 정렬,
       콘텐츠가 영역을 넘으면 modal-body 내부 스크롤 */
    .modal-azito.modal-genba-check .modal-dialog {
        margin: 56px auto 90px;
        min-height: calc(100vh - 56px - 90px);
    }

    .modal-azito.modal-genba-check .modal-dialog-scrollable {
        height: auto;
    }

    .modal-azito.modal-genba-check .modal-content {
        max-height: calc(100vh - 56px - 90px);
    }

    .modal-azito.modal-genba-check .modal-body {
        padding: 0 20px 20px;
    }

    .modal-azito.modal-genba-check .open-modal-header {
        padding-top: 16px;
    }
}

/* ===== Confirm Dialog ===== */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-confirm);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.confirm-overlay.show {
    opacity: 1;
    visibility: visible;
}

.confirm-dialog {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 28px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    text-align: center;
}

.confirm-dialog-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.confirm-dialog-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.confirm-dialog-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.confirm-dialog-actions .btn-action {
    flex: 1;
    padding: 10px 20px;
}

/* ===== Custom Time Picker ===== */
.time-picker-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-time-picker);
}

.time-picker-overlay.show {
    display: flex;
}

.time-picker-dialog {
    background: #fff;
    border-radius: 16px;
    width: 340px;
    max-width: calc(100vw - 32px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.time-picker-header {
    padding: 20px 24px 12px;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
}

.time-picker-period-tabs {
    display: flex;
    gap: 8px;
    padding: 0 24px 16px;
}

.time-picker-period-tab {
    flex: 1;
    padding: 10px 0;
    border: 1px solid var(--neutral-20, #e5e7eb);
    background: #fff;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    transition: all 0.15s ease;
}

.time-picker-period-tab.active {
    background: #E8EAED;
    border-color: transparent;
    color: var(--text-primary);
}

.time-picker-text-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 24px 16px;
}

.time-picker-text-row input {
    width: 72px;
    padding: 10px 12px;
    border: 1px solid var(--neutral-20, #e5e7eb);
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
    font-weight: 600;
    -moz-appearance: textfield;
}

.time-picker-text-row input::-webkit-outer-spin-button,
.time-picker-text-row input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.time-picker-text-row input:focus {
    outline: none;
    border-color: var(--text-primary, #1A1A1A);
}

.time-picker-text-colon {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-secondary, #6b7280);
}

.time-picker-body {
    display: flex;
    gap: 16px;
    padding: 0 24px 20px;
}

.time-picker-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.time-picker-column-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 8px;
    text-align: center;
}

.time-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px;
}

.time-picker-grid button {
    padding: 10px 0;
    border: 1px solid var(--neutral-20, #e5e7eb);
    background: #fff;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary, #111827);
    cursor: pointer;
    transition: all 0.1s ease;
}

.time-picker-grid button:hover {
    background: var(--neutral-10, #f3f4f6);
}

.time-picker-grid button.active {
    background: #E8EAED;
    border-color: transparent;
    color: var(--text-primary);
    font-weight: 700;
}

.time-picker-actions {
    display: flex;
    gap: 8px;
    padding: 12px 24px 20px;
}

.time-picker-actions button {
    flex: 1;
    padding: 12px 0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--neutral-20, #e5e7eb);
    background: #fff;
    color: var(--text-primary, #111827);
}

.time-picker-actions .time-picker-confirm {
    background: #111827;
    border-color: #111827;
    color: #fff;
}

.time-picker-actions .time-picker-cancel {
    background: var(--bg-muted);
    border-color: transparent;
    color: var(--text-primary);
}

.time-picker-actions .time-picker-cancel:hover {
    background: #E8EAED;
}

/* ===== Draft List Modal ===== */
.modal-description-center {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .modal-description-center {
        font-size: 12px;
    }
}

.draft-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    max-height: 360px;
    overflow-y: auto;
}

.draft-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--neutral-5);
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}

.draft-list-item::after {
    content: '›';
    font-size: 20px;
    color: var(--text-tertiary, var(--text-secondary));
    flex-shrink: 0;
    transition: transform 0.15s;
}

.draft-list-item:hover {
    background: var(--neutral-10);
}

.draft-list-item:hover::after {
    transform: translateX(3px);
}

.draft-list-title {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.draft-list-time {
    flex-shrink: 0;
    margin-left: auto;
    font-size: 13px;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .draft-list-title {
        max-width: 100px;
    }
}
