/* 공통 CSS (upgrade + starforce)
   필요시 추가로 분리/정리 가능 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

html,
body {
    height: 100%;
    margin: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f3f4f6;
    color: #1f2937;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.sidebar-link-active {
    background-color: #f97316;
    color: white;
}

.sidebar-link-inactive {
    background-color: transparent;
    color: #d1d5db;
}

.sidebar-link-inactive:hover {
    background-color: #4b5563;
    color: white;
}

@media (max-width: 767px) {
    .mobile-sticky-button {
        position: sticky;
        top: 0;
        z-index: 50;
    }
}

.result-grid-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.8rem;
}

.result-grid-table th,
.result-grid-table td {
    border: 1px solid #e5e7eb;
    padding: 6px;
    text-align: center;
    min-width: 80px;
    height: 40px;
}

.result-grid-table th {
    background-color: #f3f4f6;
}

.result-grid-table .action-image {
    width: 20px;
    height: 20px;
    margin-left: auto;
    margin-right: auto;
    display: block;
}

input[type="number"]:disabled {
    background-color: #e5e7eb;
    cursor: not-allowed;
    color: #6b7280;
}

.input-unit-suffix {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 0.75rem;
    pointer-events: none;
    font-size: 0.875rem;
    color: #6b7280;
}

.korean-unit-display {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
    display: block;
    min-height: 1.25rem;
}

.no-spinner::-webkit-outer-spin-button,
.no-spinner::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.no-spinner {
    appearance: textfield;
    -moz-appearance: textfield;
}

.input-error {
    border-color: #ef4444 !important;
}

.input-error:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.4) !important;
    outline: 2px solid transparent !important;
}

.tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tooltip-icon {
    width: 1rem;
    height: 1rem;
    color: #9ca3af;
    cursor: help;
    margin-left: 0.25rem;
}

.tooltip-text {
    visibility: hidden;
    width: max-content;
    max-width: 240px;
    background-color: #374151;
    color: #fff;
    text-align: left;
    border-radius: 0.375rem;
    padding: 0.5rem;
    position: absolute;
    z-index: 10;
    bottom: 135%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
    line-height: 1.5;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #374151 transparent transparent transparent;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.label-with-tooltip {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

input[type="number"],
select {
    /* Tailwind @apply 부분은 직접 CSS로 변환 필요 */
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
    background: #fff;
    color: #1f2937;
    transition: all 0.2s;
}

input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: #6b7280;
    box-shadow: 0 0 0 2px #6b7280;
}

input[type="checkbox"] {
    height: 1.25rem;
    width: 1.25rem;
    color: #f97316;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
}

select {
    background: #fff;
    color: #1f2937;
}

.selected-row {
    background-color: #fde68a !important;
}

.text-align-right {
    text-align: right;
}

.custom-radio {
    position: relative;
    padding-left: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    min-height: 2rem;
    font-size: 1rem;
    user-select: none;
}

.custom-radio input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.custom-radio .checkmark {
    position: absolute;
    left: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    height: 1.25rem;
    width: 1.25rem;
    background-color: #fff;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-radio:hover .checkmark {
    border-color: #f97316;
    box-shadow: 0 0 0 2px #fde68a;
}

.custom-radio input[type="radio"]:checked~.checkmark {
    border-color: #f97316;
    background-color: #f97316;
}

.custom-radio .checkmark:after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: white;
    display: none;
}

.custom-radio input[type="radio"]:checked~.checkmark:after {
    display: block;
}

.custom-checkbox {
    position: relative;
    padding-left: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    min-height: 2rem;
    font-size: 1rem;
    user-select: none;
}

.custom-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.custom-checkbox .checkmark {
    position: absolute;
    left: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    height: 1.25rem;
    width: 1.25rem;
    background-color: #fff;
    border: 2px solid #d1d5db;
    border-radius: 0.375rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-checkbox:hover .checkmark {
    border-color: #f97316;
    box-shadow: 0 0 0 2px #fde68a;
}

.custom-checkbox input[type="checkbox"]:checked~.checkmark {
    border-color: #f97316;
    background-color: #f97316;
}

.custom-checkbox .checkmark:after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -60%) rotate(-45deg);
    width: 0.5rem;
    height: 0.25rem;
    border-left: 2.5px solid #fff;
    border-bottom: 2.5px solid #fff;
    opacity: 0;
}

.custom-checkbox input[type="checkbox"]:checked~.checkmark:after {
    opacity: 1;
}

.input-with-label-inside {
    padding-left: 56px !important; /* 56px = 14 * 4 (tailwind pl-14) */
}

.input-label-inside {
    position: absolute;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 400;
    z-index: 10;
    /* input-unit-suffix와 동일하게 */
}
