﻿/* 정정 기능 CSS */

/* Body 스크롤 잠금 */
body.modal-open {
    overflow: hidden;
}

/* 로딩 스피너 */
.correction-loading {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
}

.correction-loading.active {
    display: block;
}

.correction-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--mainColorBlue);
    border-radius: 50%;
    animation: correction-spin 0.8s linear infinite;
}

@keyframes correction-spin {
    to { transform: rotate(360deg); }
}

/* 모달 오버레이 배경 */
.correction-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

.correction-modal-overlay.active {
    display: block;
}

/* 모달 z-index 조정 */
.modal-con.modal_correction,
.modal-con.modal_correction_history,
.modal-con.modal_correction_detail {
    z-index: 9999;
}

/* 상세 모달 차별화 스타일 */
.modal-con.modal_correction_detail {
    z-index: 10000; /* 이력 모달보다 위에 */
}

.modal-con.modal_correction_detail .title {
    background: linear-gradient(135deg, #64748b, #475569);
    color: #fff;
    padding: 20px 24px;
    font-size: 18px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(100, 116, 139, 0.15);
    position: relative;
}

.modal-con.modal_correction_detail .close {
    color: #fff;
    opacity: 0.9;
    z-index: 10;
    font-size: 20px;
}

.modal-con.modal_correction_detail .close:hover {
    opacity: 1;
    transform: scale(1.1);
}

.modal-con.modal_correction_detail .con {
    max-height: 600px;
    overflow-y: auto;
}

/* 정정 알림 */
.correction-notice {
    background: var(--contBg);
    border: var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 15px 0;
    font-size: 14px;
    color: var(--fontColor);
    display: flex;
    align-items: center;
    gap: 8px;
}

.correction-notice i {
    color: var(--mainColorBlue);
}

.correction-notice .correction-date {
    font-weight: 600;
    color: var(--mainColorBlue);
}

.correction-notice a {
    color: var(--mainColorBlue);
    text-decoration: underline;
    margin-left: auto;
}

.correction-notice a:hover {
    text-decoration: none;
}

/* 정보추가 버튼 */
.btn_correction {
    display: inline-block;
    background: var(--btnBgColor);
    border: var(--border2);
    color: #646982;
    text-decoration: none;
    vertical-align: middle;
    line-height: 35px;
    height: 35px;
    padding: 0 10px;
    text-align: center;
    font-weight: bold;
    font-size: 1.2em;
    cursor: pointer;
    -webkit-transition: background-color 0.3s ease-out;
    -moz-transition: background-color 0.3s ease-out;
    -o-transition: background-color 0.3s ease-out;
    transition: background-color 0.3s ease-out;    
}

.btn_correction:disabled {
    background: var(--disabledBg);
    color: var(--disabledColor);
    cursor: not-allowed;
    opacity: 0.6;
}

/* 모달 내부 정정 알림 */
.correction-notice-modal {
    background: var(--descriptionBg);
    border: var(--descriptionBorder);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--descriptioncolor);
    display: flex;
    align-items: center;
    gap: 8px;
}

:root[color-theme='dark'] .correction-notice-modal {
    background: rgba(33, 150, 243, 0.15);
    border-color: rgba(33, 150, 243, 0.4);
    color: #64b5f6;
}

/* 필드 선택 영역 */
.correction-field-selector {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.selector-label {
    font-size: 13px;
    color: var(--fontColor2);
    margin: 0 0 12px 0;
    font-weight: 500;
}

.field-badges {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
}

.field-badge {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--fontColor);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.field-badge i {
    font-size: 12px;
}

.field-badge:hover {
    border-color: var(--mainColorBlue);
    background: var(--prHover);
    transform: translateY(-1px);
}

.field-badge.active {
    background: var(--mainColorBlue);
    color: #fff;
    border-color: var(--mainColorBlue);
}

.field-badge.active i {
    color: #fff;
}

/* 날짜 그룹 (2-column) */
.correction-date-group {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.date-separator {
    color: var(--fontColor2);
    font-weight: 600;
    font-size: 14px;
}

/* 폼 행 토글 애니메이션 */
.correction-form-row {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 200px;
        transform: translateY(0);
    }
}

/* Tagbox 스타일 */
.correction-tagbox {
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    padding: 8px 96px 8px 8px;
    border: var(--inputBorder);
    border-radius: 6px;
    min-height: 42px;
}

.correction-tagbox:focus-within {
    border-color: var(--mainColor);
}

.correction-tagbox .tag-clear {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 4px 8px;
    font-size: 12px;
    line-height: 1.2;
    background: var(--btnBgColor);
    border: var(--border);
    border-radius: 10px;
    color: var(--fontColor2);
    cursor: pointer;
}

.correction-tagbox .tag-clear:hover {
    background: var(--btnBgColorHover);
    color: var(--fontColor);
}

.correction-tagbox .tag-clear:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.correction-tags {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.correction-tags li {
    display: flex;
    align-items: center;
    background: var(--btnBgColor);
    border: var(--border);
    color: var(--fontColor);
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 13px;
}

.correction-tags li:hover {
    background: var(--btnBgColorHover);
}

.correction-tags li .x {
    margin-left: 6px;
    border: 0;
    background: transparent;
    cursor: pointer;
    color: var(--fontColor2);
}

.correction-tags li .x:hover {
    color: var(--fontColor);
}

.correction-tagbox-input {
    flex: 1;
    min-width: 160px;
    border: 0;
    outline: 0;
    height: 28px;
    font-size: 14px;
    background: transparent;
    color: var(--fontColor);
    caret-color: var(--fontColor);
}

.correction-tagbox-input::placeholder {
    color: var(--fontColor3);
    opacity: 1;
}

.correction-tagbox-help {
    font-size: 12px;
    color: var(--fontColor3);
    margin-top: 6px;
}

#daily_remaining_count {
    font-weight: 700;
    color: var(--mainColorBlue);
}

/* 정정 폼 - 완전 독립적 스타일 */
.correction-form-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 0;
    margin: 0;
}

.correction-form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
}

.correction-form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--fontColor);
    margin: 0;
    padding: 0;
    display: block;
}

.correction-form-input {
    width: 100%;
    padding: 10px 12px;
    border: var(--inputBorder);
    border-radius: 6px;
    color: var(--fontColor);
    font-size: 14px;
    transition: all 0.2s;
    box-sizing: border-box;
    margin: 0;
}

.correction-form-input:focus {
    outline: none;
    border-color: var(--mainColorBlue);
    box-shadow: 0 0 0 3px rgba(61, 165, 244, 0.1);
}

.correction-submit-btn {
    width: 100%;
    padding: 12px;
    background: var(--mainColorBlue);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
}

.correction-submit-btn:hover {
    background: var(--mainColorBlueHover);
}

.correction-submit-btn:disabled {
    background: var(--disabledBg);
    color: var(--disabledColor);
    cursor: not-allowed;
}

/* 이력 아이템 */
.correction-history-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
}

.correction-history-item {
    background: var(--contBg);
    border: var(--border);
    border-radius: 8px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.correction-history-item:hover {
    background: var(--prHover);
    border-color: var(--mainColorBlue);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

:root[color-theme='dark'] .correction-history-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.correction-history-item.reverted {
    opacity: 0.6;
    background: var(--closedBg);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-header .field-label {
    font-weight: 600;
    color: var(--mainColorBlue);
    font-size: 14px;
}

.history-header .history-date {
    font-size: 12px;
    color: var(--fontColor2);
}

.history-content {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 14px;
}

.history-content .old-value {
    color: var(--fontRed);
    text-decoration: line-through;
}

.history-content .new-value {
    color: var(--mainColor);
    font-weight: 600;
}

.history-content i {
    color: var(--fontColor3);
    font-size: 12px;
}

.history-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}

.history-footer .mb-nick {
    font-size: 12px;
    color: var(--fontColor2);
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.reverted {
    background: var(--fontRed);
    color: #fff;
}

/* 상세 변경 박스 */
.correction-detail-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-row {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row label {
    min-width: 100px;
    font-weight: 600;
    color: var(--fontColor2);
    font-size: 13px;
}

.detail-row span {
    flex: 1;
    color: var(--fontColor);
    font-size: 14px;
}

.old-value-detail {
    color: var(--fontRed);
    text-decoration: line-through;
}

.new-value-detail {
    color: var(--mainColor);
    font-weight: 600;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .correction-notice {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .correction-notice a {
        margin-left: 0;
    }
    
    .btn_correction {
        width: 100%;
        justify-content: center;
    }
    
    .correction-form .form-row {
        gap: 4px;
    }
    
    .history-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .detail-row {
        flex-direction: column;
        gap: 4px;
    }
    
    .detail-row label {
        min-width: auto;
    }
}

/* ��� body ���� ���� �� ��ũ�� */
.modal_correction .con {
    max-height: calc(90vh - 120px);
    overflow-y: auto;
}

/* PC/����� ������ */
.pc-only { display: inline; }
.mobile-only { display: none; }

@media (max-width: 768px) {
    .pc-only { display: none; }
    .mobile-only { display: inline; }
}


/* 정정 알림 개선 */
.correction-notice {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--descriptionBg, #f8f9fa);
    border: 1px solid var(--border, #dee2e6);
}

.correction-notice-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.correction-notice-content i {
    flex-shrink: 0;
    color: var(--mainColor, #007bff);
}

.correction-notice-link {
    font-size: 12px;
    color: var(--descriptioncolor, #6c757d);
    padding-left: 24px;
}

@media (max-width: 768px) {
    .correction-notice {
        padding: 10px 14px;
    }
    
    .correction-notice-link {
        padding-left: 24px;
    }
}

@media (min-width: 769px) {
    .correction-notice {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        cursor: default !important;
    }
    
    .correction-notice-link {
        padding-left: 0;
        margin-left: auto;
    }
}

/* 필드 선택 뱃지 */
.field-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.field-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    color: var(--textColor);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.field-badge:hover {
    background: var(--hoverBg);
    border-color: var(--mainColor);
}

.field-badge.active {
    background: var(--mainColor);
    color: white;
    border-color: var(--mainColor);
}

.field-badge i {
    font-size: 12px;
}

/* 모바일 필드 뱃지 좌우 스크롤 */
@media (max-width: 768px) {
    .correction-field-selector {
        position: relative;
    }
    
    .field-badges {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 8px;
        padding: 10px 0;
        margin-top: 10px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
        padding-right: 60px;
    }
    
    .field-badges::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }
    
    /* 우측 그라데이션 오버레이 */
    .correction-field-selector::after {
        content: '';
        position: absolute;
        top: 10px;
        right: 0;
        width: 40px;
        height: calc(100% - 20px);
        background: linear-gradient(to right, transparent, var(--bodyBg, #fff));
        pointer-events: none;
        z-index: 1;
    }
    
    .field-badge {
        flex-shrink: 0;
    }
}

/* 모바일 필드 뱃지 끝 여백 추가 */
@media (max-width: 768px) {
    .field-badges {
        padding-right: 60px !important;
    }
}
