/* Pretendard 폰트 크기 보정 */
html {
    font-size: 110%;
}

/* H-STAGE 커스텀 색상 (Tailwind CDN config 미적용 대비) */
.bg-brand-600 { background-color: #c64536; }
.bg-brand-700 { background-color: #a6372b; }
.bg-brand-500 { background-color: #da6254; }
.bg-brand-100 { background-color: #fbe8e6; }
.bg-brand-50  { background-color: #fdf4f3; }
.text-brand-600 { color: #c64536; }
.text-brand-700 { color: #a6372b; }
.text-brand-800 { color: #8a3127; }
.border-brand-500 { border-color: #da6254; }
.hover\:bg-brand-700:hover { background-color: #a6372b; }
.hover\:text-brand-700:hover { color: #a6372b; }
.focus\:ring-brand-500:focus { --tw-ring-color: #da6254; }
.focus\:border-brand-500:focus { border-color: #da6254; }
.ring-brand-500 { --tw-ring-color: #da6254; }

/* 폼 입력 포커스 */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
select:focus {
    --tw-ring-color: #c64536;
    border-color: #c64536;
}

/* 테이블 입력 필드 최소 너비 */
#staffTable input,
#staffTable select,
#equipTable input {
    min-width: 80px;
}

/* ===== Toast 알림 ===== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    max-width: 26rem;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1.125rem;
    border-radius: 0.75rem;
    border: 1px solid;
    font-size: 0.9375rem;
    line-height: 1.5;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    transform: translateX(110%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.toast.toast-show {
    transform: translateX(0);
    opacity: 1;
}
.toast.toast-hide {
    transform: translateX(110%);
    opacity: 0;
}
.toast-error {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}
.toast-success {
    background-color: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}
.toast-warning {
    background-color: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}
.toast-info {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}
.toast-icon {
    flex-shrink: 0;
    font-size: 1.125rem;
    line-height: 1;
    margin-top: 0.1rem;
}

/* ===== 스크린 리더 전용 ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
}

/* ===== 커스텀 체크박스 ===== */
input[type="checkbox"].custom-check {
    appearance: none;
    -webkit-appearance: none;
    width: 1rem;
    height: 1rem;
    border: 1.5px solid #d1d5db;
    border-radius: 0.25rem;
    background-color: #fff;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
input[type="checkbox"].custom-check:hover {
    border-color: #c64536;
}
input[type="checkbox"].custom-check:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(198,69,54,0.25);
}
input[type="checkbox"].custom-check:checked {
    background-color: #c64536;
    border-color: #c64536;
}
input[type="checkbox"].custom-check:checked::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 4px;
    width: 5px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ===== 커스텀 라디오 ===== */
input[type="radio"].custom-radio {
    appearance: none;
    -webkit-appearance: none;
    width: 1rem;
    height: 1rem;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    background-color: #fff;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="radio"].custom-radio:hover {
    border-color: #c64536;
}
input[type="radio"].custom-radio:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(198,69,54,0.25);
}
input[type="radio"].custom-radio:checked {
    border-color: #c64536;
    border-width: 5px;
}

/* ===== 라디오 카드 (섹션4 운용방식) ===== */
.radio-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.radio-card:hover {
    border-color: #da6254;
    background-color: #fdf4f3;
}
.radio-card:has(input:checked) {
    background-color: #fbe8e6;
    border-color: #c64536;
    box-shadow: 0 0 0 1px #c64536;
}

/* ===== Chip 스타일 다중선택 ===== */
.chip-label {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 9999px;
    font-size: 0.75rem;
    line-height: 1.25rem;
    color: #374151;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.chip-label:hover {
    border-color: #da6254;
    background-color: #fdf4f3;
}
.chip-label:has(input:checked) {
    background-color: #c64536;
    border-color: #c64536;
    color: #fff;
    box-shadow: 0 1px 3px rgba(198,69,54,0.3);
}

/* ===== 스텝 도트 ===== */
.step-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    margin-top: 0.75rem;
}
.step-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background-color: #d1d5db;
    border: none;
    padding: 0;
    cursor: default;
    transition: background-color 0.2s, transform 0.2s;
}
.step-dot.active {
    background-color: #c64536;
    transform: scale(1.4);
}
.step-dot.completed {
    background-color: #c64536;
    opacity: 0.6;
    cursor: pointer;
}
.step-dot.completed:hover {
    opacity: 1;
    transform: scale(1.3);
}

/* ===== 서브섹션 그룹 ===== */
.section-subgroup {
    border-left: 3px solid #c64536;
    padding-left: 1rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}
.section-subgroup > h3:first-child {
    font-size: 1rem;
    font-weight: 700;
    color: #c64536;
    margin-bottom: 0.75rem;
}

/* ===== 스텝 전환 애니메이션 ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.wizard-step.step-active {
    animation: fadeIn 0.3s ease forwards;
}

/* ===== 버튼 아이콘 ===== */
.btn-icon-left::before {
    content: '\2190';
    margin-right: 0.375rem;
}
.btn-icon-right::after {
    content: '\2192';
    margin-left: 0.375rem;
}
.btn-submit {
    background-color: #059669;
}
.btn-submit:hover {
    background-color: #047857;
}

/* ===== 스마트 체크리스트 ===== */
.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    transition: background-color 0.2s, border-color 0.2s;
}
.checklist-item:has(input:checked) {
    background-color: #f0fdf4;
    border-color: #bbf7d0;
}
.checklist-item.checklist-hidden {
    display: none;
}

/* ===== 조건부 상세 입력 ===== */
.conditional-detail {
    display: none;
}
.conditional-detail.shown {
    display: block;
    animation: fadeSlideIn 0.2s ease;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== 파일 업로드 드롭존 ===== */
.file-drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}
.file-drop-zone:hover,
.file-drop-zone.drag-over {
    border-color: #c64536;
    background-color: #fdf4f3;
}
.file-drop-zone.drag-over svg {
    stroke: #c64536;
}
.file-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.625rem;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.75rem;
}
.file-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #374151;
}
.file-item-size {
    flex-shrink: 0;
    color: #9ca3af;
}
.file-item-remove {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 50%;
    font-size: 0.875rem;
    line-height: 1;
    transition: color 0.15s, background-color 0.15s;
}
.file-item-remove:hover {
    color: #ef4444;
    background-color: #fef2f2;
}

/* ===== 커스텀 셀렉트 드롭다운 ===== */
.custom-select {
    position: relative;
    display: block;
    width: 100%;
}

/* The hidden native select stays in the DOM for form submission */
.custom-select > select {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
    /* Keep it reachable by form submission but invisible */
    pointer-events: none;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background-color: #fff;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #374151;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, box-shadow 0.15s;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
}

.custom-select-trigger:hover {
    border-color: #9ca3af;
}

.custom-select-trigger:focus {
    outline: none;
    border-color: #c64536;
    box-shadow: 0 0 0 2px rgba(198,69,54,0.2);
}

.custom-select.is-open .custom-select-trigger {
    border-color: #c64536;
    box-shadow: 0 0 0 2px rgba(198,69,54,0.2);
}

.custom-select-trigger-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-trigger-text.is-placeholder {
    color: #9ca3af;
}

.custom-select-arrow {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: transform 0.2s ease;
}

.custom-select.is-open .custom-select-arrow {
    transform: rotate(180deg);
    color: #c64536;
}

.custom-select-dropdown {
    position: fixed;
    z-index: 9990;
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.625rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.06);
    max-height: 15rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: none;
    padding: 0.25rem;
}

.custom-select-dropdown.is-open {
    display: block;
    animation: customSelectOpen 0.15s ease forwards;
}

@keyframes customSelectOpen {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-select-option {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 0.375rem;
    background: none;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #374151;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.1s;
    white-space: nowrap;
}

.custom-select-option:hover,
.custom-select-option.is-focused {
    background-color: #fdf4f3;
    color: #c64536;
}

.custom-select-option.is-selected {
    background-color: #fbe8e6;
    color: #c64536;
    font-weight: 500;
}

.custom-select-option.is-selected.is-focused {
    background-color: #fbe8e6;
}

.custom-select-option.is-placeholder-option {
    color: #9ca3af;
}

/* 컴팩트 사이즈 (테이블 내부용) */
.custom-select-sm .custom-select-trigger {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 0.25rem;
}
.custom-select-dropdown-sm {
    border-radius: 0.375rem;
}
.custom-select-dropdown-sm .custom-select-option {
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
    border-radius: 0.25rem;
}

/* Scrollbar styling for the dropdown */
.custom-select-dropdown::-webkit-scrollbar {
    width: 4px;
}
.custom-select-dropdown::-webkit-scrollbar-track {
    background: transparent;
}
.custom-select-dropdown::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 2px;
}

/* ===== 반응형 테이블 → 카드 ===== */
@media (max-width: 640px) {
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }

    .table-card-mobile thead {
        display: none;
    }
    .table-card-mobile tbody tr {
        display: block;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        padding: 0.75rem;
        margin-bottom: 0.5rem;
        background: #fff;
    }
    .table-card-mobile tbody td {
        display: flex;
        align-items: center;
        padding: 0.25rem 0;
        border: none;
    }
    .table-card-mobile tbody td::before {
        content: attr(data-label);
        font-size: 0.6875rem;
        font-weight: 500;
        color: #6b7280;
        min-width: 5rem;
        flex-shrink: 0;
    }
    .table-card-mobile tbody td:first-child {
        display: none;
    }
    .table-card-mobile tbody td:last-child {
        justify-content: flex-end;
    }
    .table-card-mobile tbody td input,
    .table-card-mobile tbody td select {
        min-width: 0;
        flex: 1;
    }
}
