/* ============================================
   손익계산 탭 전용 스타일
   ============================================ */

/* 컨테이너 */
.profit-loss-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* 헤더 영역 */
.profit-loss-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.profit-loss-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.profit-loss-title h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.profit-loss-title-icon {
    font-size: 2rem;
}

/* 탭 네비게이션 */
.profit-loss-tabs {
    display: flex;
    gap: 0.5rem;
    background: #f9fafb;
    padding: 0.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.profit-loss-tab {
    flex: 1;
    padding: 0.875rem 1.5rem;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.profit-loss-tab:hover {
    background: #e5e7eb;
    color: #374151;
}

.profit-loss-tab.active {
    background: white;
    color: #7c3aed;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* 필터 바 */
.profit-loss-filter {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-icon {
    font-size: 1.125rem;
}

.filter-select {
    padding: 0.625rem 2.5rem 0.625rem 1rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #1f2937;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.filter-select:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

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

/* 메인 카드 */
.profit-loss-main-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 2.5rem;
    margin-bottom: 2rem;
}

/* 손익 플로우 */
.profit-flow {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.profit-flow-item {
    padding: 1.5rem 2rem;
    border-left: 4px solid transparent;
    transition: all 0.2s ease;
}

.profit-flow-item:hover {
    background: #f9fafb;
}

.profit-flow-item.carry-forward {
    background: #f0f9ff;
    border-left-color: #3b82f6;
}

.profit-flow-item.revenue {
    background: #f0fdf4;
    border-left-color: #10b981;
}

.profit-flow-item.labor-cost {
    background: #fef3c7;
    border-left-color: #f59e0b;
}

.profit-flow-item.operating-expense {
    background: #fee2e2;
    border-left-color: #ef4444;
}

.profit-flow-item.net-profit {
    background: #ede9fe;
    border-left-color: #7c3aed;
    border: 2px solid #7c3aed;
    border-radius: 8px;
    margin: 1rem 0;
}

.profit-flow-item.next-carry {
    background: #dbeafe;
    border-left-color: #2563eb;
    border-radius: 8px;
}

.flow-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.flow-item-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.flow-item-label-icon {
    font-size: 1.125rem;
}

.flow-item-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    background: #e5e7eb;
    color: #6b7280;
}

.flow-item-amount {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1f2937;
}

.flow-item-amount.positive {
    color: #10b981;
}

.flow-item-amount.negative {
    color: #ef4444;
}

.flow-item-amount.highlight {
    color: #7c3aed;
    font-size: 2.25rem;
}

.flow-item-description {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
    padding-left: 1.625rem;
}

/* 운영지출 섹션 */
.operating-expense-section {
    margin-top: 1rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    border: 2px dashed #d1d5db;
}

.operating-expense-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.operating-expense-title {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
}

.btn-add-expense {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: #7c3aed;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-expense:hover {
    background: #6d28d9;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(124, 58, 237, 0.2);
}

.btn-add-expense:active {
    transform: translateY(0);
}

/* 운영지출 리스트 */
.expense-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.expense-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.expense-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.expense-item-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.expense-item-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1f2937;
    min-width: 120px;
}

.expense-item-amount {
    font-size: 1.125rem;
    font-weight: 700;
    color: #ef4444;
}

.expense-item-memo {
    font-size: 0.875rem;
    color: #6b7280;
    flex: 1;
    padding-left: 1rem;
    border-left: 1px solid #e5e7eb;
}

.expense-item-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-expense-action {
    padding: 0.5rem 0.875rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-expense-edit {
    background: #f3f4f6;
    color: #374151;
}

.btn-expense-edit:hover {
    background: #e5e7eb;
}

.btn-expense-delete {
    background: #fee2e2;
    color: #dc2626;
}

.btn-expense-delete:hover {
    background: #fecaca;
}

.expense-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: #fef2f2;
    border-radius: 8px;
    margin-top: 1rem;
    border: 2px solid #fecaca;
}

.expense-total-label {
    font-size: 1rem;
    font-weight: 700;
    color: #374151;
}

.expense-total-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #dc2626;
}

/* 빈 상태 */
.expense-empty {
    text-align: center;
    padding: 3rem 2rem;
    color: #9ca3af;
}

.expense-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.expense-empty-text {
    font-size: 0.9375rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.expense-empty-hint {
    font-size: 0.875rem;
    color: #9ca3af;
}

/* 모달 */
.expense-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.expense-modal.active {
    opacity: 1;
    visibility: visible;
}

.expense-modal-content {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.expense-modal.active .expense-modal-content {
    transform: scale(1);
}

.expense-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.expense-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
}

.btn-modal-close {
    width: 2rem;
    height: 2rem;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    font-size: 1.25rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-modal-close:hover {
    background: #e5e7eb;
    color: #374151;
}

.expense-modal-body {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-label.required::after {
    content: '*';
    color: #ef4444;
    margin-left: 0.25rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9375rem;
    color: #1f2937;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.form-input::placeholder {
    color: #9ca3af;
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

.expense-modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.btn-modal {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-modal-cancel {
    background: #f3f4f6;
    color: #374151;
}

.btn-modal-cancel:hover {
    background: #e5e7eb;
}

.btn-modal-submit {
    background: #7c3aed;
    color: white;
}

.btn-modal-submit:hover {
    background: #6d28d9;
    box-shadow: 0 4px 6px rgba(124, 58, 237, 0.2);
}

.btn-modal-submit:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* 반응형 */
@media (max-width: 768px) {
    /* PC 레이아웃 유지 + 가로 스크롤 */
    .profit-loss-container {
        padding: 1rem;
        min-width: 900px;
    }

    .profit-loss-header {
        flex-direction: row;
        align-items: center;
    }

    .profit-loss-tabs {
        flex-direction: row;
    }

    .profit-loss-filter {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        gap: 10px;
    }

    .profit-loss-filter .filter-group {
        flex-direction: row;
        align-items: center;
        flex-shrink: 0;
        gap: 6px;
    }

    .profit-loss-filter .filter-select {
        width: auto;
    }

    .profit-flow-item {
        padding: 1rem 1.25rem;
    }

    .flow-item-amount {
        font-size: 1.5rem;
    }

    .flow-item-amount.highlight {
        font-size: 1.75rem;
    }

    .expense-item {
        flex-direction: row;
        align-items: center;
    }

    .expense-item-info {
        flex-direction: row;
        align-items: center;
    }

    .expense-item-memo {
        padding-left: 1rem;
        border-left: 1px solid #e5e7eb;
    }

    .expense-modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .expense-modal-footer {
        flex-direction: column;
    }

    .btn-modal {
        width: 100%;
    }
}
